type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/pagevec.h>
includes
#include <linux/writeback.h>
includes
#include <linux/task_io_accounting_ops.h>
includes
#include <linux/delay.h>
includes
#include <linux/mount.h>
includes
#include <asm/div64.h>
functions
int cifs_convert_flags(unsigned int flags) { if ((flags & O_ACCMODE) == O_RDONLY) return GENERIC_READ; else if ((flags & O_ACCMODE) == O_WRONLY) return GENERIC_WRITE; else if ((flags & O_ACCMODE) == O_RDWR) { /* GENERIC_ALL is too much permission to request can cause unnecessary access denied on create */...
functions
u32 cifs_posix_convert_flags(unsigned int flags) { u32 posix_flags = 0; if ((flags & O_ACCMODE) == O_RDONLY) posix_flags = SMB_O_RDONLY; else if ((flags & O_ACCMODE) == O_WRONLY) posix_flags = SMB_O_WRONLY; else if ((flags & O_ACCMODE) == O_RDWR) posix_flags = SMB_O_RDWR; if (flags & O_CREAT) posix_flags...
functions
int cifs_get_disposition(unsigned int flags) { if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) return FILE_CREATE; else if ((flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) return FILE_OVERWRITE_IF; else if ((flags & O_CREAT) == O_CREAT) return FILE_OPEN_IF; else if ((flags & O_TRUNC) == O_TRUNC)...
functions
int cifs_open_inode_helper(struct inode *inode, struct cifsTconInfo *pTcon, __u32 oplock, FILE_ALL_INFO *buf, char *full_path, int xid) { struct cifsInodeInfo *pCifsInode = CIFS_I(inode); struct timespec temp; int rc; if (pCifsInode->clientCanCacheRead) { /* we have the inode open somewhere else no need t...
functions
int cifs_posix_open(char *full_path, struct inode **pinode, struct super_block *sb, int mode, unsigned int f_flags, __u32 *poplock, __u16 *pnetfid, int xid) { int rc; FILE_UNIX_BASIC_INFO *presp_data; __u32 posix_flags = 0; struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_fattr fattr; struct tcon_lin...
functions
void cifsFileInfo_put(struct cifsFileInfo *cifs_file) { struct inode *inode = cifs_file->dentry->d_inode; struct cifsTconInfo *tcon = tlink_tcon(cifs_file->tlink); struct cifsInodeInfo *cifsi = CIFS_I(inode); struct cifsLockInfo *li, *tmp; spin_lock(&cifs_file_list_lock); if (--cifs_file->count > 0) { spin_unl...
functions
int cifs_open(struct inode *inode, struct file *file) { int rc = -EACCES; int xid; __u32 oplock; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *tcon; struct tcon_link *tlink; struct cifsFileInfo *pCifsFile = NULL; struct cifsInodeInfo *pCifsInode; char *full_path = NULL; int desiredAccess; int dispositio...
functions
int cifs_relock_file(struct cifsFileInfo *cifsFile) { int rc = 0; /* BB list all locks open on this file and relock */ return rc; }
functions
int cifs_reopen_file(struct cifsFileInfo *pCifsFile, bool can_flush) { int rc = -EACCES; int xid; __u32 oplock; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *tcon; struct cifsInodeInfo *pCifsInode; struct inode *inode; char *full_path = NULL; int desiredAccess; int disposition = FILE_OPEN; __u16 netfid;...
functions
int cifs_close(struct inode *inode, struct file *file) { if (file->private_data != NULL) { cifsFileInfo_put(file->private_data); file->private_data = NULL; }
functions
int cifs_closedir(struct inode *inode, struct file *file) { int rc = 0; int xid; struct cifsFileInfo *pCFileStruct = file->private_data; char *ptmp; cFYI(1, "Closedir inode = 0x%p", inode); xid = GetXid(); if (pCFileStruct) { struct cifsTconInfo *pTcon = tlink_tcon(pCFileStruct->tlink); cFYI(1, "Freeing ...
functions
int store_file_lock(struct cifsFileInfo *fid, __u64 len, __u64 offset, __u8 lockType) { struct cifsLockInfo *li = kmalloc(sizeof(struct cifsLockInfo), GFP_KERNEL); if (li == NULL) return -ENOMEM; li->offset = offset; li->length = len; li->type = lockType; mutex_lock(&fid->lock_mutex); list_add(&li->llist...
functions
int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) { int rc, xid; __u32 numLock = 0; __u32 numUnlock = 0; __u64 length; bool wait_flag = false; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *tcon; __u16 netfid; __u8 lockType = LOCKING_ANDX_LARGE_FILES; bool posix_locking = 0; length = 1...
functions
else if (pfLock->fl_type == F_UNLCK) { cFYI(1, "F_UNLCK"); numUnlock = 1; /* Check if unlock includes more than one lock range */ }
functions
else if (pfLock->fl_type == F_RDLCK) { cFYI(1, "F_RDLCK"); lockType |= LOCKING_ANDX_SHARED_LOCK; numLock = 1; }
functions
else if (pfLock->fl_type == F_EXLCK) { cFYI(1, "F_EXLCK"); numLock = 1; }
functions
else if (pfLock->fl_type == F_SHLCK) { cFYI(1, "F_SHLCK"); lockType |= LOCKING_ANDX_SHARED_LOCK; numLock = 1; }
functions
else if (numUnlock) { /* For each stored lock that this unlock overlaps completely, unlock it. */ int stored_rc = 0; struct cifsLockInfo *li, *tmp; rc = 0; mutex_lock(&fid->lock_mutex); list_for_each_entry_safe(li, tmp, &fid->llist, llist) { if (pfLock->fl_start <= li->offset && (pfLo...
functions
void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset, unsigned int bytes_written) { loff_t end_of_write = offset + bytes_written; if (end_of_write > cifsi->server_eof) cifsi->server_eof = end_of_write; }
functions
ssize_t cifs_user_write(struct file *file, const char __user *write_data, size_t write_size, loff_t *poffset) { struct inode *inode = file->f_path.dentry->d_inode; int rc = 0; unsigned int bytes_written = 0; unsigned int total_written; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int xid; struct c...
functions
ssize_t cifs_write(struct cifsFileInfo *open_file, const char *write_data, size_t write_size, loff_t *poffset) { int rc = 0; unsigned int bytes_written = 0; unsigned int total_written; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int xid; struct dentry *dentry = open_file->dentry; struct ...
functions
int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) { struct address_space *mapping = page->mapping; loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT; char *write_data; int rc = -EFAULT; int bytes_written = 0; struct cifs_sb_info *cifs_sb; struct inode *inode; struct cifsFileInfo *op...
functions
int cifs_writepages(struct address_space *mapping, struct writeback_control *wbc) { struct backing_dev_info *bdi = mapping->backing_dev_info; struct cifs_sb_info *cifs_sb = CIFS_SB(mapping->host->i_sb); bool done = false, scanned = false, range_whole = false; pgoff_t end, index; struct cifs_writedata *wdata;...
functions
int cifs_writepage(struct page *page, struct writeback_control *wbc) { int rc = -EFAULT; int xid; xid = GetXid(); /* BB add check for wbc flags */ page_cache_get(page); if (!PageUptodate(page)) cFYI(1, "ppw - page not up to date"); /* * Set the "writeback" flag, and clear "dirty" in the radix tree. * * ...
functions
int cifs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { int rc; struct inode *inode = mapping->host; cFYI(1, "write_end for page %p from pos %lld with %d bytes", page, pos, copied); if (PageChecked(page)) { if (c...
functions
int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) { int xid; int rc = 0; struct cifsTconInfo *tcon; struct cifsFileInfo *smbfile = file->private_data; struct inode *inode = file->f_path.dentry->d_inode; xid = GetXid(); cFYI(1, "Sync file - name: %s datasync: 0x%x", dentry->d_name.name, d...
functions
void cifs_sync_page(struct page *page) { struct address_space *mapping; struct inode *inode; unsigned long index = page->index; unsigned int rpages = 0; int rc = 0; cFYI(1, "sync page %p", page); mapping = page->mapping; if (!mapping) return 0; inode = mapping->host; if (!inode) return; */ /* fill in rp...
functions
int cifs_flush(struct file *file, fl_owner_t id) { struct inode *inode = file->f_path.dentry->d_inode; int rc = 0; if (file->f_mode & FMODE_WRITE) rc = filemap_write_and_wait(inode->i_mapping); cFYI(1, "Flush inode %p file %p rc %d", inode, file, rc); return rc; }
functions
ssize_t cifs_user_read(struct file *file, char __user *read_data, size_t read_size, loff_t *poffset) { int rc = -EACCES; unsigned int bytes_read = 0; unsigned int total_read = 0; unsigned int current_read_size; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int xid; struct cifsFileInfo *open_file; ...
functions
ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *poffset) { int rc = -EACCES; unsigned int bytes_read = 0; unsigned int total_read; unsigned int current_read_size; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int xid; char *current_offset; struct cifsFileInfo *open_...
functions
int cifs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page = vmf->page; lock_page(page); return VM_FAULT_LOCKED; }
functions
int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) { int rc, xid; xid = GetXid(); rc = cifs_revalidate_file(file); if (rc) { cFYI(1, "Validation prior to mmap failed, error=%d", rc); FreeXid(xid); return rc; }
functions
void cifs_copy_cache_pages(struct address_space *mapping, struct list_head *pages, int bytes_read, char *data) { struct page *page; char *target; while (bytes_read > 0) { if (list_empty(pages)) break; page = list_entry(pages->prev, struct page, lru); list_del(&page->lru); if (add_to_page_cache_lru(pag...
functions
int cifs_readpages(struct file *file, struct address_space *mapping, struct list_head *page_list, unsigned num_pages) { int rc = -EACCES; int xid; loff_t offset; struct page *page; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; unsigned int bytes_read = 0; unsigned int read_size, i; char *smb_read_...
functions
else if (bytes_read > 0) { task_io_account_read(bytes_read); pSMBr = (struct smb_com_read_rsp *)smb_read_data; cifs_copy_cache_pages(mapping, page_list, bytes_read, smb_read_data + 4 /* RFC1001 hdr */ + le16_to_cpu(pSMBr->DataOffset)); i += bytes_read >> PAGE_CACHE_SHIFT; cifs_stats_bytes_read(...
functions
int cifs_readpage_worker(struct file *file, struct page *page, loff_t *poffset) { char *read_data; int rc; /* Is the page cached? */ rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page); if (rc == 0) goto read_complete; page_cache_get(page); read_data = kmap(page); /* for reads over a certai...
functions
int cifs_readpage(struct file *file, struct page *page) { loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT; int rc = -EACCES; int xid; xid = GetXid(); if (file->private_data == NULL) { rc = -EBADF; FreeXid(xid); return rc; }
functions
int is_inode_writable(struct cifsInodeInfo *cifs_inode) { struct cifsFileInfo *open_file; spin_lock(&cifs_file_list_lock); list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) { spin_unlock(&cifs_file_list_lock); return 1; }
functions
bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) { if (!cifsInode) return true; if (is_inode_writable(cifsInode)) { /* This inode is open for write at least once */ struct cifs_sb_info *cifs_sb; cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); if (cifs_sb->mnt_cifs_flags & CIFS...
functions
int cifs_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { pgoff_t index = pos >> PAGE_CACHE_SHIFT; loff_t offset = pos & (PAGE_CACHE_SIZE - 1); loff_t page_start = pos & PAGE_MASK; loff_t i_size; struct page *page; ...
functions
int cifs_release_page(struct page *page, gfp_t gfp) { if (PagePrivate(page)) return 0; return cifs_fscache_release_page(page, gfp); }
functions
void cifs_invalidate_page(struct page *page, unsigned long offset) { struct cifsInodeInfo *cifsi = CIFS_I(page->mapping->host); if (offset == 0) cifs_fscache_invalidate_page(page, &cifsi->vfs_inode); }
functions
void cifs_oplock_break(struct slow_work *work) { struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, oplock_break); struct inode *inode = cfile->dentry->d_inode; struct cifsInodeInfo *cinode = CIFS_I(inode); int rc = 0; if (inode && S_ISREG(inode->i_mode)) { if (cinode->clientCanCacheRe...
functions
int cifs_oplock_break_get(struct slow_work *work) { struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, oplock_break); cifs_sb_active(cfile->dentry->d_sb); cifsFileInfo_get(cfile); return 0; }
functions
void cifs_oplock_break_put(struct slow_work *work) { struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, oplock_break); struct super_block *sb = cfile->dentry->d_sb; cifsFileInfo_put(cfile); cifs_sb_deactive(sb); }
includes
#include <linux/kernel.h>
includes
#include <linux/module.h>
includes
#include <linux/init.h>
includes
#include <linux/pci.h>
includes
#include <linux/pci-aspm.h>
includes
#include <linux/slab.h>
includes
#include <linux/dma-mapping.h>
includes
#include <linux/delay.h>
includes
#include <linux/sched.h>
includes
#include <linux/skbuff.h>
includes
#include <linux/netdevice.h>
includes
#include <linux/wireless.h>
includes
#include <linux/firmware.h>
includes
#include <linux/etherdevice.h>
includes
#include <linux/if_arp.h>
includes
#include <net/ieee80211_radiotap.h>
includes
#include <net/mac80211.h>
includes
#include <asm/div64.h>
defines
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
defines
#define DRV_NAME "iwl3945"
defines
#define DRV_DESCRIPTION \
defines
#define VD "d"
defines
#define VD
defines
#define DRV_VERSION IWLWIFI_VERSION VD "s"
defines
#define DRV_COPYRIGHT "Copyright(c) 2003-2010 Intel Corporation"
defines
#define DRV_AUTHOR "<ilw@linux.intel.com>"
defines
#define ERROR_START_OFFSET (1 * sizeof(u32))
defines
#define ERROR_ELEM_SIZE (7 * sizeof(u32))
defines
#define EVENT_START_OFFSET (6 * sizeof(u32))
defines
#define DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES (20)
defines
#define IWL3945_UCODE_GET(item) \
defines
#define MAX_HW_RESTARTS 5
defines
#define UCODE_READY_TIMEOUT (2 * HZ)
defines
#define CHK(test, flag) do { \
defines
#define IWL3945_MAX_PROBE_REQUEST 200
functions
__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) { struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; switch (iwl3945_mod_params.antenna) { case IWL_ANTENNA_DIVERSITY: return 0; case IWL_ANTENNA_MAIN: if (eeprom->antenna_switch_type) return RXON_FLG_DIS_DIV_MSK | RXON_FLG_A...
functions
int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { unsigned long flags; __le16 key_flags = 0; int ret; key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); if (sta_i...
functions
int iwl3945_set_tkip_dynamic_key_info(struct iwl_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { return -EOPNOTSUPP; }
functions
int iwl3945_set_wep_dynamic_key_info(struct iwl_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { return -EOPNOTSUPP; }
functions
int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) { unsigned long flags; struct iwl_addsta_cmd sta_cmd; spin_lock_irqsave(&priv->sta_lock, flags); memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl4965_keyinfo)); pr...
functions
int iwl3945_set_dynamic_key(struct iwl_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { int ret = 0; keyconf->hw_key_idx = HW_KEY_DYNAMIC; switch (keyconf->cipher) { case WLAN_CIPHER_SUITE_CCMP: ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_TKIP:...
functions
int iwl3945_remove_static_key(struct iwl_priv *priv) { int ret = -EOPNOTSUPP; return ret; }
functions
int iwl3945_set_static_key(struct iwl_priv *priv, struct ieee80211_key_conf *key) { if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || key->cipher == WLAN_CIPHER_SUITE_WEP104) return -EOPNOTSUPP; IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); return -EINVAL; }
functions
void iwl3945_clear_free_frames(struct iwl_priv *priv) { struct list_head *element; IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", priv->frames_count); while (!list_empty(&priv->free_frames)) { element = priv->free_frames.next; list_del(element); kfree(list_entry(element, struct ...
functions
void iwl3945_free_frame(struct iwl_priv *priv, struct iwl3945_frame *frame) { memset(frame, 0, sizeof(*frame)); list_add(&frame->list, &priv->free_frames); }
functions
int iwl3945_fill_beacon_frame(struct iwl_priv *priv, struct ieee80211_hdr *hdr, int left) { if (!iwl_is_associated(priv, IWL_RXON_CTX_BSS) || !priv->beacon_skb) return 0; if (priv->beacon_skb->len > left) return 0; memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len); return priv->beacon_skb->...
functions
int iwl3945_send_beacon_cmd(struct iwl_priv *priv) { struct iwl3945_frame *frame; unsigned int frame_size; int rc; u8 rate; frame = iwl3945_get_free_frame(priv); if (!frame) { IWL_ERR(priv, "Could not obtain free frame buffer for beacon " "command.\n"); return -ENOMEM; }
functions
void iwl3945_unset_hw_params(struct iwl_priv *priv) { if (priv->_3945.shared_virt) dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl3945_shared), priv->_3945.shared_virt, priv->_3945.shared_phys); }
functions
void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, struct ieee80211_tx_info *info, struct iwl_device_cmd *cmd, struct sk_buff *skb_frag, int sta_id) { struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; struct iwl_hw_key *keyinfo = &priv->stations[...