8009 lines
293 KiB
Plaintext
8009 lines
293 KiB
Plaintext
From: Sankar P <psankar@novell.com>
|
|
Subject: [PATCH] novfs: Lindent novfs sources.
|
|
Patch-mainline: never
|
|
References: none
|
|
|
|
The sources of novfs had numerous coding-style issues. So I ran Lindent on the
|
|
sources with just one modification.
|
|
|
|
I set the character limit to 132 instead of 80, as it is more readable and
|
|
suggested by Linus in a mailing-list.
|
|
|
|
Signed-off-by: Sankar P <psankar@novell.com>
|
|
Acked-by: Jan Kara <jack@suse.cz>
|
|
|
|
---
|
|
fs/novfs/commands.h | 7
|
|
fs/novfs/daemon.c | 559 +++++++--------------
|
|
fs/novfs/file.c | 478 ++++++------------
|
|
fs/novfs/inode.c | 1355 ++++++++++++++++------------------------------------
|
|
fs/novfs/nwcapi.c | 601 +++++++----------------
|
|
fs/novfs/nwcapi.h | 16
|
|
fs/novfs/nwerror.h | 3
|
|
fs/novfs/proc.c | 18
|
|
fs/novfs/profile.c | 158 +-----
|
|
fs/novfs/scope.c | 89 +--
|
|
fs/novfs/vfs.h | 258 +++------
|
|
11 files changed, 1148 insertions(+), 2394 deletions(-)
|
|
|
|
--- a/fs/novfs/commands.h
|
|
+++ b/fs/novfs/commands.h
|
|
@@ -159,7 +159,6 @@ struct novfs_command_reply_header {
|
|
|
|
};
|
|
|
|
-
|
|
struct novfs_delete_file_request {
|
|
struct novfs_command_request_header Command;
|
|
unsigned int isDirectory;
|
|
@@ -681,7 +680,6 @@ struct nwd_server_version {
|
|
unsigned short int uRevision;
|
|
};
|
|
|
|
-
|
|
#define MAX_ADDRESS_LENGTH 32
|
|
|
|
struct tagNwdTranAddrEx {
|
|
@@ -933,8 +931,7 @@ struct novfs_set_file_lock_reply {
|
|
|
|
};
|
|
|
|
-
|
|
-struct novfs_scope_list{
|
|
+struct novfs_scope_list {
|
|
struct list_head ScopeList;
|
|
struct novfs_schandle ScopeId;
|
|
struct novfs_schandle SessionId;
|
|
@@ -952,4 +949,4 @@ struct novfs_scope_list{
|
|
|
|
#pragma pack(pop)
|
|
|
|
-#endif /* __NOVFS_COMMANDS_H */
|
|
+#endif /* __NOVFS_COMMANDS_H */
|
|
--- a/fs/novfs/daemon.c
|
|
+++ b/fs/novfs/daemon.c
|
|
@@ -89,17 +89,16 @@ struct drive_map {
|
|
char name[1];
|
|
};
|
|
|
|
-static void Queue_get(struct daemon_cmd * Que);
|
|
-static void Queue_put(struct daemon_cmd * Que);
|
|
+static void Queue_get(struct daemon_cmd *Que);
|
|
+static void Queue_put(struct daemon_cmd *Que);
|
|
static void RemoveDriveMaps(void);
|
|
-static int NwdConvertLocalHandle(struct novfs_xplat *pdata, struct daemon_handle * DHandle);
|
|
-static int NwdConvertNetwareHandle(struct novfs_xplat *pdata, struct daemon_handle * DHandle);
|
|
+static int NwdConvertLocalHandle(struct novfs_xplat *pdata, struct daemon_handle *DHandle);
|
|
+static int NwdConvertNetwareHandle(struct novfs_xplat *pdata, struct daemon_handle *DHandle);
|
|
static int set_map_drive(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
static int unmap_drive(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
static int NwdGetMountPath(struct novfs_xplat *pdata);
|
|
static long local_unlink(const char *pathname);
|
|
|
|
-
|
|
/*===[ Global variables ]=================================================*/
|
|
static struct daemon_queue Daemon_Queue;
|
|
|
|
@@ -130,7 +129,7 @@ void novfs_daemon_queue_exit(void)
|
|
/*++======================================================================*/
|
|
static void novfs_daemon_timer(unsigned long data)
|
|
{
|
|
- struct daemon_cmd *que = (struct daemon_cmd *) data;
|
|
+ struct daemon_cmd *que = (struct daemon_cmd *)data;
|
|
|
|
if (QUEUE_ACKED != que->status) {
|
|
que->status = QUEUE_TIMEOUT;
|
|
@@ -140,10 +139,7 @@ static void novfs_daemon_timer(unsigned
|
|
|
|
/*++======================================================================*/
|
|
int Queue_Daemon_Command(void *request,
|
|
- unsigned long reqlen,
|
|
- void *data,
|
|
- int dlen,
|
|
- void **reply, unsigned long * replen, int interruptible)
|
|
+ unsigned long reqlen, void *data, int dlen, void **reply, unsigned long *replen, int interruptible)
|
|
{
|
|
struct daemon_cmd *que;
|
|
int retCode = 0;
|
|
@@ -167,15 +163,14 @@ int Queue_Daemon_Command(void *request,
|
|
|
|
que->sequence = atomic_inc_return(&Sequence);
|
|
|
|
- ((struct novfs_command_request_header *) request)->SequenceNumber =
|
|
- que->sequence;
|
|
+ ((struct novfs_command_request_header *)request)->SequenceNumber = que->sequence;
|
|
|
|
/*
|
|
* Setup and start que timer
|
|
*/
|
|
init_timer(&que->timer);
|
|
que->timer.expires = jiffies + (HZ * Daemon_Command_Timeout);
|
|
- que->timer.data = (unsigned long) que;
|
|
+ que->timer.data = (unsigned long)que;
|
|
que->timer.function = novfs_daemon_timer;
|
|
add_timer(&que->timer);
|
|
|
|
@@ -222,12 +217,9 @@ int Queue_Daemon_Command(void *request,
|
|
|
|
if (QUEUE_ACKED == que->status) {
|
|
que->status = QUEUE_WAITING;
|
|
- mod_timer(&que->timer,
|
|
- jiffies +
|
|
- (HZ * 2 * Daemon_Command_Timeout));
|
|
+ mod_timer(&que->timer, jiffies + (HZ * 2 * Daemon_Command_Timeout));
|
|
if (interruptible) {
|
|
- retCode =
|
|
- down_interruptible(&que->semaphore);
|
|
+ retCode = down_interruptible(&que->semaphore);
|
|
} else {
|
|
down(&que->semaphore);
|
|
}
|
|
@@ -273,13 +265,13 @@ int Queue_Daemon_Command(void *request,
|
|
return (retCode);
|
|
}
|
|
|
|
-static void Queue_get(struct daemon_cmd * Que)
|
|
+static void Queue_get(struct daemon_cmd *Que)
|
|
{
|
|
DbgPrint("que=0x%p %d", Que, atomic_read(&Que->reference));
|
|
atomic_inc(&Que->reference);
|
|
}
|
|
|
|
-static void Queue_put(struct daemon_cmd * Que)
|
|
+static void Queue_put(struct daemon_cmd *Que)
|
|
{
|
|
|
|
DbgPrint("que=0x%p %d", Que, atomic_read(&Que->reference));
|
|
@@ -308,14 +300,14 @@ struct daemon_cmd *get_next_queue(int Se
|
|
DbgPrint("que=0x%p", Daemon_Queue.list.next);
|
|
|
|
spin_lock(&Daemon_Queue.lock);
|
|
- que = (struct daemon_cmd *) Daemon_Queue.list.next;
|
|
+ que = (struct daemon_cmd *)Daemon_Queue.list.next;
|
|
|
|
- while (que && (que != (struct daemon_cmd *) & Daemon_Queue.list.next)
|
|
+ while (que && (que != (struct daemon_cmd *)&Daemon_Queue.list.next)
|
|
&& (que->status != QUEUE_SENDING)) {
|
|
- que = (struct daemon_cmd *) que->list.next;
|
|
+ que = (struct daemon_cmd *)que->list.next;
|
|
}
|
|
|
|
- if ((NULL == que) || (que == (struct daemon_cmd *) & Daemon_Queue.list)
|
|
+ if ((NULL == que) || (que == (struct daemon_cmd *)&Daemon_Queue.list)
|
|
|| (que->status != QUEUE_SENDING)) {
|
|
que = NULL;
|
|
} else if (Set_Queue_Waiting) {
|
|
@@ -339,15 +331,15 @@ static struct daemon_cmd *find_queue(uns
|
|
DbgPrint("0x%x", sequence);
|
|
|
|
spin_lock(&Daemon_Queue.lock);
|
|
- que = (struct daemon_cmd *) Daemon_Queue.list.next;
|
|
+ que = (struct daemon_cmd *)Daemon_Queue.list.next;
|
|
|
|
- while (que && (que != (struct daemon_cmd *) & Daemon_Queue.list.next)
|
|
+ while (que && (que != (struct daemon_cmd *)&Daemon_Queue.list.next)
|
|
&& (que->sequence != sequence)) {
|
|
- que = (struct daemon_cmd *) que->list.next;
|
|
+ que = (struct daemon_cmd *)que->list.next;
|
|
}
|
|
|
|
if ((NULL == que)
|
|
- || (que == (struct daemon_cmd *) & Daemon_Queue.list.next)
|
|
+ || (que == (struct daemon_cmd *)&Daemon_Queue.list.next)
|
|
|| (que->sequence != sequence)) {
|
|
que = NULL;
|
|
}
|
|
@@ -364,8 +356,7 @@ static struct daemon_cmd *find_queue(uns
|
|
|
|
int novfs_daemon_open_control(struct inode *Inode, struct file *File)
|
|
{
|
|
- DbgPrint("pid=%d Count=%d", current->pid,
|
|
- atomic_read(&Daemon_Open_Count));
|
|
+ DbgPrint("pid=%d Count=%d", current->pid, atomic_read(&Daemon_Open_Count));
|
|
atomic_inc(&Daemon_Open_Count);
|
|
|
|
return (0);
|
|
@@ -375,8 +366,7 @@ int novfs_daemon_close_control(struct in
|
|
{
|
|
struct daemon_cmd *que;
|
|
|
|
- DbgPrint("pid=%d Count=%d", current->pid,
|
|
- atomic_read(&Daemon_Open_Count));
|
|
+ DbgPrint("pid=%d Count=%d", current->pid, atomic_read(&Daemon_Open_Count));
|
|
|
|
if (atomic_dec_and_test(&Daemon_Open_Count)) {
|
|
/*
|
|
@@ -384,15 +374,14 @@ int novfs_daemon_close_control(struct in
|
|
*/
|
|
|
|
spin_lock(&Daemon_Queue.lock);
|
|
- que = (struct daemon_cmd *) Daemon_Queue.list.next;
|
|
+ que = (struct daemon_cmd *)Daemon_Queue.list.next;
|
|
|
|
- while (que
|
|
- && (que != (struct daemon_cmd *) & Daemon_Queue.list.next)
|
|
+ while (que && (que != (struct daemon_cmd *)&Daemon_Queue.list.next)
|
|
&& (que->status != QUEUE_DONE)) {
|
|
que->status = QUEUE_TIMEOUT;
|
|
up(&que->semaphore);
|
|
|
|
- que = (struct daemon_cmd *) que->list.next;
|
|
+ que = (struct daemon_cmd *)que->list.next;
|
|
}
|
|
spin_unlock(&Daemon_Queue.lock);
|
|
|
|
@@ -441,44 +430,29 @@ ssize_t novfs_daemon_cmd_send(struct fil
|
|
if (DLREAD == dlist->rwflag) {
|
|
bcnt = dlist->len;
|
|
DbgPrint("page=0x%p "
|
|
- "offset=0x%p len=%d",
|
|
- i, dlist->page,
|
|
- dlist->offset, dlist->len);
|
|
+ "offset=0x%p len=%d", i, dlist->page, dlist->offset, dlist->len);
|
|
if ((bcnt + retValue) <= len) {
|
|
void *km_adr = NULL;
|
|
|
|
if (dlist->page) {
|
|
- km_adr =
|
|
- kmap(dlist->
|
|
- page);
|
|
+ km_adr = kmap(dlist->page);
|
|
vadr = km_adr;
|
|
- vadr +=
|
|
- (unsigned long)
|
|
- dlist->
|
|
- offset;
|
|
+ vadr += (unsigned long)
|
|
+ dlist->offset;
|
|
} else {
|
|
- vadr =
|
|
- dlist->
|
|
- offset;
|
|
+ vadr = dlist->offset;
|
|
}
|
|
|
|
- ccnt =
|
|
- copy_to_user(buf,
|
|
- vadr,
|
|
- bcnt);
|
|
+ ccnt = copy_to_user(buf, vadr, bcnt);
|
|
|
|
- DbgPrint("Copy %d from 0x%p to 0x%p.",
|
|
- bcnt, vadr, buf);
|
|
+ DbgPrint("Copy %d from 0x%p to 0x%p.", bcnt, vadr, buf);
|
|
if (bcnt > 0x80)
|
|
- novfs_dump(0x80,
|
|
- vadr);
|
|
+ novfs_dump(0x80, vadr);
|
|
else
|
|
- novfs_dump(bcnt,
|
|
- vadr);
|
|
+ novfs_dump(bcnt, vadr);
|
|
|
|
if (km_adr) {
|
|
- kunmap(dlist->
|
|
- page);
|
|
+ kunmap(dlist->page);
|
|
}
|
|
|
|
retValue += bcnt;
|
|
@@ -497,10 +471,8 @@ ssize_t novfs_daemon_cmd_send(struct fil
|
|
retValue = -EAGAIN;
|
|
break;
|
|
} else {
|
|
- if ((error =
|
|
- down_interruptible(&Daemon_Queue.semaphore))) {
|
|
- DbgPrint("after down_interruptible error...%d",
|
|
- error);
|
|
+ if ((error = down_interruptible(&Daemon_Queue.semaphore))) {
|
|
+ DbgPrint("after down_interruptible error...%d", error);
|
|
retValue = -EINTR;
|
|
break;
|
|
}
|
|
@@ -515,7 +487,7 @@ ssize_t novfs_daemon_cmd_send(struct fil
|
|
return (retValue);
|
|
}
|
|
|
|
-ssize_t novfs_daemon_recv_reply(struct file *file, const char *buf, size_t nbytes, loff_t * ppos)
|
|
+ssize_t novfs_daemon_recv_reply(struct file * file, const char *buf, size_t nbytes, loff_t * ppos)
|
|
{
|
|
struct daemon_cmd *que;
|
|
size_t retValue = 0;
|
|
@@ -526,8 +498,7 @@ ssize_t novfs_daemon_recv_reply(struct f
|
|
char *vadr;
|
|
int i;
|
|
|
|
- DbgPrint("buf=0x%p nbytes=%d ppos=%llx", buf,
|
|
- nbytes, *ppos);
|
|
+ DbgPrint("buf=0x%p nbytes=%d ppos=%llx", buf, nbytes, *ppos);
|
|
|
|
/*
|
|
* Get sequence number from reply buffer
|
|
@@ -557,30 +528,22 @@ ssize_t novfs_daemon_recv_reply(struct f
|
|
int thiscopy, left = nbytes;
|
|
retValue = 0;
|
|
|
|
- DbgPrint("dlist=0x%p count=%d",
|
|
- dlist, que->datalen);
|
|
- for (i = 0;
|
|
- (i < que->datalen) && (retValue < nbytes);
|
|
- i++, dlist++) {
|
|
+ DbgPrint("dlist=0x%p count=%d", dlist, que->datalen);
|
|
+ for (i = 0; (i < que->datalen) && (retValue < nbytes); i++, dlist++) {
|
|
__DbgPrint("\n"
|
|
- " dlist[%d].page: 0x%p\n"
|
|
- " dlist[%d].offset: 0x%p\n"
|
|
- " dlist[%d].len: 0x%x\n"
|
|
- " dlist[%d].rwflag: 0x%x\n",
|
|
- i, dlist->page, i,
|
|
- dlist->offset, i, dlist->len,
|
|
- i, dlist->rwflag);
|
|
+ " dlist[%d].page: 0x%p\n"
|
|
+ " dlist[%d].offset: 0x%p\n"
|
|
+ " dlist[%d].len: 0x%x\n"
|
|
+ " dlist[%d].rwflag: 0x%x\n",
|
|
+ i, dlist->page, i, dlist->offset, i, dlist->len, i, dlist->rwflag);
|
|
|
|
if (DLWRITE == dlist->rwflag) {
|
|
void *km_adr = NULL;
|
|
|
|
if (dlist->page) {
|
|
- km_adr =
|
|
- kmap(dlist->page);
|
|
+ km_adr = kmap(dlist->page);
|
|
vadr = km_adr;
|
|
- vadr +=
|
|
- (unsigned long) dlist->
|
|
- offset;
|
|
+ vadr += (unsigned long)dlist->offset;
|
|
} else {
|
|
vadr = dlist->offset;
|
|
}
|
|
@@ -590,9 +553,7 @@ ssize_t novfs_daemon_recv_reply(struct f
|
|
thiscopy = left;
|
|
dlist->len = left;
|
|
}
|
|
- cpylen =
|
|
- copy_from_user(vadr, buf,
|
|
- thiscopy);
|
|
+ cpylen = copy_from_user(vadr, buf, thiscopy);
|
|
|
|
if (thiscopy > 0x80)
|
|
novfs_dump(0x80, vadr);
|
|
@@ -617,9 +578,7 @@ ssize_t novfs_daemon_recv_reply(struct f
|
|
que->reply = reply;
|
|
que->replen = nbytes;
|
|
|
|
- retValue -=
|
|
- copy_from_user(reply, buf,
|
|
- retValue);
|
|
+ retValue -= copy_from_user(reply, buf, retValue);
|
|
if (retValue > 0x80)
|
|
novfs_dump(0x80, reply);
|
|
else
|
|
@@ -646,7 +605,7 @@ ssize_t novfs_daemon_recv_reply(struct f
|
|
}
|
|
|
|
int novfs_do_login(struct ncl_string *Server, struct ncl_string *Username,
|
|
-struct ncl_string *Password, void **lgnId, struct novfs_schandle *Session)
|
|
+ struct ncl_string *Password, void **lgnId, struct novfs_schandle *Session)
|
|
{
|
|
struct novfs_login_user_request *cmd;
|
|
struct novfs_login_user_reply *reply;
|
|
@@ -660,31 +619,30 @@ struct ncl_string *Password, void **lgnI
|
|
if (!cmd)
|
|
return -ENOMEM;
|
|
|
|
- data = (unsigned char *) cmd + sizeof(*cmd);
|
|
+ data = (unsigned char *)cmd + sizeof(*cmd);
|
|
cmd->Command.CommandType = VFS_COMMAND_LOGIN_USER;
|
|
cmd->Command.SequenceNumber = 0;
|
|
memcpy(&cmd->Command.SessionId, Session, sizeof(*Session));
|
|
|
|
cmd->srvNameType = Server->type;
|
|
cmd->serverLength = Server->len;
|
|
- cmd->serverOffset = (unsigned long) (data - (unsigned char *) cmd);
|
|
+ cmd->serverOffset = (unsigned long)(data - (unsigned char *)cmd);
|
|
memcpy(data, Server->buffer, Server->len);
|
|
data += Server->len;
|
|
|
|
cmd->usrNameType = Username->type;
|
|
cmd->userNameLength = Username->len;
|
|
- cmd->userNameOffset = (unsigned long) (data - (unsigned char *) cmd);
|
|
+ cmd->userNameOffset = (unsigned long)(data - (unsigned char *)cmd);
|
|
memcpy(data, Username->buffer, Username->len);
|
|
data += Username->len;
|
|
|
|
cmd->pwdNameType = Password->type;
|
|
cmd->passwordLength = Password->len;
|
|
- cmd->passwordOffset = (unsigned long) (data - (unsigned char *) cmd);
|
|
+ cmd->passwordOffset = (unsigned long)(data - (unsigned char *)cmd);
|
|
memcpy(data, Password->buffer, Password->len);
|
|
data += Password->len;
|
|
|
|
- retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (reply->Reply.ErrorCode) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
@@ -720,8 +678,7 @@ int novfs_daemon_logout(struct qstr *Ser
|
|
cmd->length = Server->len;
|
|
memcpy(cmd->Name, Server->name, Server->len);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (reply->Reply.ErrorCode) {
|
|
retCode = -EIO;
|
|
@@ -745,18 +702,15 @@ int novfs_daemon_getpwuid(uid_t uid, int
|
|
SC_INITIALIZE(cmd.Command.SessionId);
|
|
cmd.uid = uid;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (reply->Reply.ErrorCode) {
|
|
retCode = -EIO;
|
|
} else {
|
|
retCode = 0;
|
|
memset(uname, 0, unamelen);
|
|
- replylen =
|
|
- replylen - offsetof(struct
|
|
- novfs_getpwuid_reply, UserName);
|
|
+ replylen = replylen - offsetof(struct
|
|
+ novfs_getpwuid_reply, UserName);
|
|
if (replylen) {
|
|
if (replylen > unamelen) {
|
|
retCode = -EINVAL;
|
|
@@ -782,15 +736,13 @@ int novfs_daemon_getversion(char *Buf, i
|
|
cmd.Command.SequenceNumber = 0;
|
|
SC_INITIALIZE(cmd.Command.SessionId);
|
|
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (reply->Reply.ErrorCode) {
|
|
retVal = -EIO;
|
|
} else {
|
|
- retVal =
|
|
- replylen - offsetof(struct
|
|
- novfs_get_version_reply, Version);
|
|
+ retVal = replylen - offsetof(struct
|
|
+ novfs_get_version_reply, Version);
|
|
if (retVal < length) {
|
|
memcpy(Buf, reply->Version, retVal);
|
|
Buf[retVal] = '\0';
|
|
@@ -819,18 +771,19 @@ static int daemon_login(struct novfs_log
|
|
server.len = lLogin.Server.length;
|
|
server.type = NWC_STRING_TYPE_ASCII;
|
|
if (!copy_from_user((void *)server.buffer, lLogin.Server.data, server.len)) {
|
|
- username.buffer = kmalloc(lLogin.UserName.length, GFP_KERNEL);
|
|
+ username.buffer = kmalloc(lLogin.UserName.length, GFP_KERNEL);
|
|
if (username.buffer) {
|
|
username.len = lLogin.UserName.length;
|
|
username.type = NWC_STRING_TYPE_ASCII;
|
|
if (!copy_from_user((void *)username.buffer, lLogin.UserName.data, username.len)) {
|
|
- password.buffer = kmalloc(lLogin.Password.length, GFP_KERNEL);
|
|
- if (password.buffer)
|
|
- {
|
|
+ password.buffer = kmalloc(lLogin.Password.length, GFP_KERNEL);
|
|
+ if (password.buffer) {
|
|
password.len = lLogin.Password.length;
|
|
password.type = NWC_STRING_TYPE_ASCII;
|
|
- if (!copy_from_user((void *)password.buffer, lLogin.Password.data, password.len)) {
|
|
- retCode = novfs_do_login (&server, &username, &password, NULL, Session);
|
|
+ if (!copy_from_user
|
|
+ ((void *)password.buffer, lLogin.Password.data, password.len)) {
|
|
+ retCode =
|
|
+ novfs_do_login(&server, &username, &password, NULL, Session);
|
|
if (!retCode) {
|
|
char *username;
|
|
username = novfs_scope_get_username();
|
|
@@ -874,7 +827,7 @@ exit:
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_daemon_create_sessionId(struct novfs_schandle * SessionId)
|
|
+int novfs_daemon_create_sessionId(struct novfs_schandle *SessionId)
|
|
{
|
|
struct novfs_create_context_request cmd;
|
|
struct novfs_create_context_reply *reply;
|
|
@@ -887,12 +840,9 @@ int novfs_daemon_create_sessionId(struct
|
|
cmd.Command.SequenceNumber = 0;
|
|
SC_INITIALIZE(cmd.Command.SessionId);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
- if (!reply->Reply.ErrorCode
|
|
- && replylen > sizeof(struct novfs_command_reply_header)) {
|
|
+ if (!reply->Reply.ErrorCode && replylen > sizeof(struct novfs_command_reply_header)) {
|
|
*SessionId = reply->SessionId;
|
|
retCode = 0;
|
|
} else {
|
|
@@ -913,16 +863,13 @@ int novfs_daemon_destroy_sessionId(struc
|
|
unsigned long replylen = 0;
|
|
int retCode = 0;
|
|
|
|
- DbgPrint("0x%p:%p", SessionId.hTypeId,
|
|
- SessionId.hId);
|
|
+ DbgPrint("0x%p:%p", SessionId.hTypeId, SessionId.hId);
|
|
|
|
cmd.Command.CommandType = VFS_COMMAND_DESTROY_CONTEXT;
|
|
cmd.Command.SequenceNumber = 0;
|
|
cmd.Command.SessionId = SessionId;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (!reply->Reply.ErrorCode) {
|
|
struct drive_map *dm;
|
|
@@ -956,24 +903,20 @@ int novfs_daemon_destroy_sessionId(struc
|
|
}
|
|
|
|
int novfs_daemon_get_userspace(struct novfs_schandle SessionId, uint64_t * TotalSize,
|
|
- uint64_t * Free, uint64_t * TotalEnties,
|
|
- uint64_t * FreeEnties)
|
|
+ uint64_t * Free, uint64_t * TotalEnties, uint64_t * FreeEnties)
|
|
{
|
|
struct novfs_get_user_space cmd;
|
|
struct novfs_get_user_space_reply *reply;
|
|
unsigned long replylen = 0;
|
|
int retCode = 0;
|
|
|
|
- DbgPrint("0x%p:%p", SessionId.hTypeId,
|
|
- SessionId.hId);
|
|
+ DbgPrint("0x%p:%p", SessionId.hTypeId, SessionId.hId);
|
|
|
|
cmd.Command.CommandType = VFS_COMMAND_GET_USER_SPACE;
|
|
cmd.Command.SequenceNumber = 0;
|
|
cmd.Command.SessionId = SessionId;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (!reply->Reply.ErrorCode) {
|
|
|
|
@@ -1024,9 +967,7 @@ int novfs_daemon_set_mnt_point(char *Pat
|
|
|
|
replylen = 0;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (!reply->Reply.ErrorCode) {
|
|
retCode = 0;
|
|
@@ -1070,9 +1011,7 @@ int novfs_daemon_debug_cmd_send(char *Co
|
|
|
|
replylen = 0;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, cmdlen, dlist, 2, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, cmdlen, dlist, 2, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
kfree(reply);
|
|
}
|
|
@@ -1092,7 +1031,7 @@ int novfs_daemon_ioctl(struct inode *ino
|
|
|
|
switch (cmd) {
|
|
case IOC_LOGIN:
|
|
- retCode = daemon_login((struct novfs_login *) arg, &session_id);
|
|
+ retCode = daemon_login((struct novfs_login *)arg, &session_id);
|
|
break;
|
|
|
|
case IOC_LOGOUT:
|
|
@@ -1113,9 +1052,7 @@ int novfs_daemon_ioctl(struct inode *ino
|
|
buf = kmalloc(io.length + 1, GFP_KERNEL);
|
|
if (buf) {
|
|
buf[0] = 0;
|
|
- cpylen =
|
|
- copy_from_user(buf, io.data,
|
|
- io.length);
|
|
+ cpylen = copy_from_user(buf, io.data, io.length);
|
|
buf[io.length] = '\0';
|
|
DbgPrint("%s", buf);
|
|
kfree(buf);
|
|
@@ -1129,8 +1066,7 @@ int novfs_daemon_ioctl(struct inode *ino
|
|
{
|
|
struct novfs_xplat data;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&data, (void *)arg, sizeof(data));
|
|
+ cpylen = copy_from_user(&data, (void *)arg, sizeof(data));
|
|
retCode = ((data.xfunction & 0x0000FFFF) | 0xCC000000);
|
|
|
|
switch (data.xfunction) {
|
|
@@ -1148,18 +1084,16 @@ int novfs_daemon_ioctl(struct inode *ino
|
|
return (retCode);
|
|
}
|
|
|
|
-static int daemon_added_resource(struct daemon_handle * DHandle, int Type, void *CHandle,
|
|
- unsigned char * FHandle, unsigned long Mode, u_long Size)
|
|
+static int daemon_added_resource(struct daemon_handle *DHandle, int Type, void *CHandle,
|
|
+ unsigned char *FHandle, unsigned long Mode, u_long Size)
|
|
{
|
|
struct daemon_resource *resource;
|
|
|
|
if (FHandle)
|
|
DbgPrint("DHandle=0x%p Type=%d CHandle=0x%p FHandle=0x%x "
|
|
- "Mode=0x%x Size=%d", DHandle, Type, CHandle,
|
|
- *(u32 *) & FHandle[2], Mode, Size);
|
|
+ "Mode=0x%x Size=%d", DHandle, Type, CHandle, *(u32 *) & FHandle[2], Mode, Size);
|
|
else
|
|
- DbgPrint("DHandle=0x%p Type=%d CHandle=0x%p\n",
|
|
- DHandle, Type, CHandle);
|
|
+ DbgPrint("DHandle=0x%p Type=%d CHandle=0x%p\n", DHandle, Type, CHandle);
|
|
|
|
resource = kmalloc(sizeof(struct daemon_resource), GFP_KERNEL);
|
|
if (!resource)
|
|
@@ -1168,8 +1102,7 @@ static int daemon_added_resource(struct
|
|
resource->type = Type;
|
|
resource->connection = CHandle;
|
|
if (FHandle)
|
|
- memcpy(resource->handle, FHandle,
|
|
- sizeof(resource->handle));
|
|
+ memcpy(resource->handle, FHandle, sizeof(resource->handle));
|
|
else
|
|
memset(resource->handle, 0, sizeof(resource->handle));
|
|
resource->mode = Mode;
|
|
@@ -1181,23 +1114,20 @@ static int daemon_added_resource(struct
|
|
return 0;
|
|
}
|
|
|
|
-static int daemon_remove_resource(struct daemon_handle * DHandle, int Type, void *CHandle,
|
|
- unsigned long FHandle)
|
|
+static int daemon_remove_resource(struct daemon_handle *DHandle, int Type, void *CHandle, unsigned long FHandle)
|
|
{
|
|
struct daemon_resource *resource;
|
|
struct list_head *l;
|
|
int retVal = -ENOMEM;
|
|
|
|
- DbgPrint("DHandle=0x%p Type=%d CHandle=0x%p FHandle=0x%x",
|
|
- DHandle, Type, CHandle, FHandle);
|
|
+ DbgPrint("DHandle=0x%p Type=%d CHandle=0x%p FHandle=0x%x", DHandle, Type, CHandle, FHandle);
|
|
|
|
write_lock(&DHandle->lock);
|
|
|
|
list_for_each(l, &DHandle->list) {
|
|
resource = list_entry(l, struct daemon_resource, list);
|
|
|
|
- if ((Type == resource->type) &&
|
|
- (resource->connection == CHandle)) {
|
|
+ if ((Type == resource->type) && (resource->connection == CHandle)) {
|
|
DbgPrint("Found resource=0x%p", resource);
|
|
l = l->prev;
|
|
list_del(&resource->list);
|
|
@@ -1240,34 +1170,26 @@ int novfs_daemon_lib_close(struct inode
|
|
|
|
DbgPrint("inode=0x%p file=0x%p", inode, file);
|
|
if (file->private_data) {
|
|
- dh = (struct daemon_handle *) file->private_data;
|
|
+ dh = (struct daemon_handle *)file->private_data;
|
|
|
|
list_for_each(l, &dh->list) {
|
|
resource = list_entry(l, struct daemon_resource, list);
|
|
|
|
if (DH_TYPE_STREAM == resource->type) {
|
|
- novfs_close_stream(resource->connection,
|
|
- resource->handle,
|
|
- dh->session);
|
|
+ novfs_close_stream(resource->connection, resource->handle, dh->session);
|
|
} else if (DH_TYPE_CONNECTION == resource->type) {
|
|
- cmd = (struct novfs_xplat_call_request *) commanddata;
|
|
- cmdlen =
|
|
- offsetof(struct novfs_xplat_call_request,
|
|
- data) + sizeof(struct nwd_close_conn);
|
|
- cmd->Command.CommandType =
|
|
- VFS_COMMAND_XPLAT_CALL;
|
|
+ cmd = (struct novfs_xplat_call_request *)commanddata;
|
|
+ cmdlen = offsetof(struct novfs_xplat_call_request, data) + sizeof(struct nwd_close_conn);
|
|
+ cmd->Command.CommandType = VFS_COMMAND_XPLAT_CALL;
|
|
cmd->Command.SequenceNumber = 0;
|
|
cmd->Command.SessionId = dh->session;
|
|
cmd->NwcCommand = NWC_CLOSE_CONN;
|
|
|
|
cmd->dataLen = sizeof(struct nwd_close_conn);
|
|
- nwdClose = (struct nwd_close_conn *) cmd->data;
|
|
- nwdClose->ConnHandle =
|
|
- (void *) resource->connection;
|
|
-
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL,
|
|
- 0, (void **)&reply,
|
|
- &replylen, 0);
|
|
+ nwdClose = (struct nwd_close_conn *)cmd->data;
|
|
+ nwdClose->ConnHandle = (void *)resource->connection;
|
|
+
|
|
+ Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, 0);
|
|
if (reply)
|
|
kfree(reply);
|
|
}
|
|
@@ -1282,8 +1204,7 @@ int novfs_daemon_lib_close(struct inode
|
|
return (0);
|
|
}
|
|
|
|
-ssize_t novfs_daemon_lib_read(struct file * file, char *buf, size_t len,
|
|
- loff_t * off)
|
|
+ssize_t novfs_daemon_lib_read(struct file * file, char *buf, size_t len, loff_t * off)
|
|
{
|
|
struct daemon_handle *dh;
|
|
struct daemon_resource *resource;
|
|
@@ -1297,16 +1218,13 @@ ssize_t novfs_daemon_lib_read(struct fil
|
|
dh = file->private_data;
|
|
read_lock(&dh->lock);
|
|
if (&dh->list != dh->list.next) {
|
|
- resource =
|
|
- list_entry(dh->list.next, struct daemon_resource, list);
|
|
+ resource = list_entry(dh->list.next, struct daemon_resource, list);
|
|
|
|
if (DH_TYPE_STREAM == resource->type) {
|
|
while (len > 0 && (offset < resource->size)) {
|
|
thisread = len;
|
|
if (novfs_read_stream
|
|
- (resource->connection,
|
|
- resource->handle, buf, &thisread,
|
|
- &offset, 1, dh->session)
|
|
+ (resource->connection, resource->handle, buf, &thisread, &offset, 1, dh->session)
|
|
|| !thisread) {
|
|
break;
|
|
}
|
|
@@ -1324,8 +1242,7 @@ ssize_t novfs_daemon_lib_read(struct fil
|
|
return (totalread);
|
|
}
|
|
|
|
-ssize_t novfs_daemon_lib_write(struct file * file, const char *buf, size_t len,
|
|
- loff_t * off)
|
|
+ssize_t novfs_daemon_lib_write(struct file * file, const char *buf, size_t len, loff_t * off)
|
|
{
|
|
struct daemon_handle *dh;
|
|
struct daemon_resource *resource;
|
|
@@ -1340,21 +1257,15 @@ ssize_t novfs_daemon_lib_write(struct fi
|
|
dh = file->private_data;
|
|
write_lock(&dh->lock);
|
|
if (&dh->list != dh->list.next) {
|
|
- resource =
|
|
- list_entry(dh->list.next, struct daemon_resource, list);
|
|
+ resource = list_entry(dh->list.next, struct daemon_resource, list);
|
|
|
|
if ((DH_TYPE_STREAM == resource->type) && (len >= 0)) {
|
|
totalwrite = 0;
|
|
do {
|
|
thiswrite = len;
|
|
status =
|
|
- novfs_write_stream(resource->
|
|
- connection,
|
|
- resource->handle,
|
|
- (void *)buf,
|
|
- &thiswrite,
|
|
- &offset,
|
|
- dh->session);
|
|
+ novfs_write_stream(resource->connection,
|
|
+ resource->handle, (void *)buf, &thiswrite, &offset, dh->session);
|
|
if (status || !thiswrite) {
|
|
/*
|
|
* If len is zero then the file will have just been
|
|
@@ -1397,8 +1308,7 @@ loff_t novfs_daemon_lib_llseek(struct fi
|
|
dh = file->private_data;
|
|
read_lock(&dh->lock);
|
|
if (&dh->list != dh->list.next) {
|
|
- resource =
|
|
- list_entry(dh->list.next, struct daemon_resource, list);
|
|
+ resource = list_entry(dh->list.next, struct daemon_resource, list);
|
|
|
|
if (DH_TYPE_STREAM == resource->type) {
|
|
switch (origin) {
|
|
@@ -1457,20 +1367,14 @@ int novfs_daemon_lib_ioctl(struct inode
|
|
} io;
|
|
char *buf;
|
|
io.length = 0;
|
|
- cpylen =
|
|
- copy_from_user(&io, (void *)arg,
|
|
- sizeof(io));
|
|
+ cpylen = copy_from_user(&io, (void *)arg, sizeof(io));
|
|
if (io.length <= 0 || io.length > 1024)
|
|
return -EINVAL;
|
|
if (io.length) {
|
|
- buf =
|
|
- kmalloc(io.length + 1,
|
|
- GFP_KERNEL);
|
|
+ buf = kmalloc(io.length + 1, GFP_KERNEL);
|
|
if (buf) {
|
|
buf[0] = 0;
|
|
- cpylen =
|
|
- copy_from_user(buf, io.data,
|
|
- io.length);
|
|
+ cpylen = copy_from_user(buf, io.data, io.length);
|
|
buf[io.length] = '\0';
|
|
__DbgPrint("%s", buf);
|
|
kfree(buf);
|
|
@@ -1484,243 +1388,177 @@ int novfs_daemon_lib_ioctl(struct inode
|
|
{
|
|
struct novfs_xplat data;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&data, (void *)arg,
|
|
- sizeof(data));
|
|
+ cpylen = copy_from_user(&data, (void *)arg, sizeof(data));
|
|
retCode = ((data.xfunction & 0x0000FFFF) | 0xCC000000);
|
|
|
|
switch (data.xfunction) {
|
|
case NWC_OPEN_CONN_BY_NAME:
|
|
DbgIocCall("NwOpenConnByName");
|
|
- retCode =
|
|
- novfs_open_conn_by_name(&data,
|
|
- &handle, dh->session);
|
|
+ retCode = novfs_open_conn_by_name(&data, &handle, dh->session);
|
|
if (!retCode)
|
|
- daemon_added_resource(dh,
|
|
- DH_TYPE_CONNECTION,handle, 0, 0, 0);
|
|
+ daemon_added_resource(dh, DH_TYPE_CONNECTION, handle, 0, 0, 0);
|
|
break;
|
|
|
|
case NWC_OPEN_CONN_BY_ADDRESS:
|
|
DbgIocCall("NwOpenConnByAddress");
|
|
- retCode =
|
|
- novfs_open_conn_by_addr(&data, &handle,
|
|
- dh->session);
|
|
+ retCode = novfs_open_conn_by_addr(&data, &handle, dh->session);
|
|
if (!retCode)
|
|
- daemon_added_resource(dh,
|
|
- DH_TYPE_CONNECTION,
|
|
- handle, 0,
|
|
- 0, 0);
|
|
+ daemon_added_resource(dh, DH_TYPE_CONNECTION, handle, 0, 0, 0);
|
|
break;
|
|
|
|
case NWC_OPEN_CONN_BY_REFERENCE:
|
|
|
|
DbgIocCall("NwOpenConnByReference");
|
|
- retCode =
|
|
- novfs_open_conn_by_ref(&data, &handle,
|
|
- dh->session);
|
|
+ retCode = novfs_open_conn_by_ref(&data, &handle, dh->session);
|
|
if (!retCode)
|
|
- daemon_added_resource(dh,
|
|
- DH_TYPE_CONNECTION,
|
|
- handle, 0,
|
|
- 0, 0);
|
|
+ daemon_added_resource(dh, DH_TYPE_CONNECTION, handle, 0, 0, 0);
|
|
break;
|
|
|
|
case NWC_SYS_CLOSE_CONN:
|
|
DbgIocCall("NwSysCloseConn");
|
|
- retCode =
|
|
- novfs_sys_conn_close(&data, (unsigned long *)&handle, dh->session);
|
|
+ retCode = novfs_sys_conn_close(&data, (unsigned long *)&handle, dh->session);
|
|
daemon_remove_resource(dh, DH_TYPE_CONNECTION, handle, 0);
|
|
break;
|
|
|
|
case NWC_CLOSE_CONN:
|
|
DbgIocCall("NwCloseConn");
|
|
- retCode =
|
|
- novfs_conn_close(&data, &handle,
|
|
- dh->session);
|
|
- daemon_remove_resource(dh,
|
|
- DH_TYPE_CONNECTION,
|
|
- handle, 0);
|
|
+ retCode = novfs_conn_close(&data, &handle, dh->session);
|
|
+ daemon_remove_resource(dh, DH_TYPE_CONNECTION, handle, 0);
|
|
break;
|
|
|
|
case NWC_LOGIN_IDENTITY:
|
|
- DbgIocCall(""
|
|
- "NwLoginIdentity");
|
|
- retCode =
|
|
- novfs_login_id(&data, dh->session);
|
|
+ DbgIocCall("" "NwLoginIdentity");
|
|
+ retCode = novfs_login_id(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_RAW_NCP_REQUEST:
|
|
- DbgIocCall("[VFS XPLAT] Send Raw "
|
|
- "NCP Request");
|
|
+ DbgIocCall("[VFS XPLAT] Send Raw " "NCP Request");
|
|
retCode = novfs_raw_send(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_AUTHENTICATE_CONN_WITH_ID:
|
|
- DbgIocCall("[VFS XPLAT] Authenticate "
|
|
- "Conn With ID");
|
|
- retCode =
|
|
- novfs_auth_conn(&data,
|
|
- dh->session);
|
|
+ DbgIocCall("[VFS XPLAT] Authenticate " "Conn With ID");
|
|
+ retCode = novfs_auth_conn(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_UNAUTHENTICATE_CONN:
|
|
- DbgIocCall("[VFS XPLAT] UnAuthenticate "
|
|
- "Conn With ID");
|
|
- retCode =
|
|
- novfs_unauthenticate(&data,
|
|
- dh->session);
|
|
+ DbgIocCall("[VFS XPLAT] UnAuthenticate " "Conn With ID");
|
|
+ retCode = novfs_unauthenticate(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_LICENSE_CONN:
|
|
DbgIocCall("Call NwLicenseConn");
|
|
- retCode =
|
|
- novfs_license_conn(&data, dh->session);
|
|
+ retCode = novfs_license_conn(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_LOGOUT_IDENTITY:
|
|
DbgIocCall("NwLogoutIdentity");
|
|
- retCode =
|
|
- novfs_logout_id(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_logout_id(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_UNLICENSE_CONN:
|
|
DbgIocCall("NwUnlicense");
|
|
- retCode =
|
|
- novfs_unlicense_conn(&data, dh->session);
|
|
+ retCode = novfs_unlicense_conn(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_CONN_INFO:
|
|
DbgIocCall("NwGetConnInfo");
|
|
- retCode =
|
|
- novfs_get_conn_info(&data, dh->session);
|
|
+ retCode = novfs_get_conn_info(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_SET_CONN_INFO:
|
|
DbgIocCall("NwSetConnInfo");
|
|
- retCode =
|
|
- novfs_set_conn_info(&data, dh->session);
|
|
+ retCode = novfs_set_conn_info(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_SCAN_CONN_INFO:
|
|
DbgIocCall("NwScanConnInfo");
|
|
- retCode =
|
|
- novfs_scan_conn_info(&data, dh->session);
|
|
+ retCode = novfs_scan_conn_info(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_IDENTITY_INFO:
|
|
DbgIocCall("NwGetIdentityInfo");
|
|
- retCode =
|
|
- novfs_get_id_info(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_get_id_info(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_REQUESTER_VERSION:
|
|
DbgIocCall("NwGetDaemonVersion");
|
|
- retCode =
|
|
- novfs_get_daemon_ver(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_get_daemon_ver(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_PREFERRED_DS_TREE:
|
|
DbgIocCall("NwcGetPreferredDsTree");
|
|
- retCode =
|
|
- novfs_get_preferred_DS_tree(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_get_preferred_DS_tree(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_SET_PREFERRED_DS_TREE:
|
|
DbgIocCall("NwcSetPreferredDsTree");
|
|
- retCode =
|
|
- novfs_set_preferred_DS_tree(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_set_preferred_DS_tree(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_DEFAULT_NAME_CONTEXT:
|
|
DbgIocCall("NwcGetDefaultNameContext");
|
|
- retCode =
|
|
- novfs_get_default_ctx(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_get_default_ctx(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_SET_DEFAULT_NAME_CONTEXT:
|
|
DbgIocCall("NwcSetDefaultNameContext");
|
|
- retCode =
|
|
- novfs_set_default_ctx(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_set_default_ctx(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_QUERY_FEATURE:
|
|
DbgIocCall("NwQueryFeature");
|
|
- retCode =
|
|
- novfs_query_feature(&data, dh->session);
|
|
+ retCode = novfs_query_feature(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_TREE_MONITORED_CONN_REF:
|
|
DbgIocCall("NwcGetTreeMonitoredConn");
|
|
- retCode =
|
|
- novfs_get_tree_monitored_conn(&data,
|
|
- dh->
|
|
- session);
|
|
+ retCode = novfs_get_tree_monitored_conn(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_ENUMERATE_IDENTITIES:
|
|
DbgIocCall("NwcEnumerateIdentities");
|
|
- retCode =
|
|
- novfs_enum_ids(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_enum_ids(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_CHANGE_KEY:
|
|
DbgIocCall("NwcChangeAuthKey");
|
|
- retCode =
|
|
- novfs_change_auth_key(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_change_auth_key(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_CONVERT_LOCAL_HANDLE:
|
|
DbgIocCall("NwdConvertLocalHandle");
|
|
- retCode =
|
|
- NwdConvertLocalHandle(&data, dh);
|
|
+ retCode = NwdConvertLocalHandle(&data, dh);
|
|
break;
|
|
|
|
case NWC_CONVERT_NETWARE_HANDLE:
|
|
DbgIocCall("NwdConvertNetwareHandle");
|
|
- retCode =
|
|
- NwdConvertNetwareHandle(&data, dh);
|
|
+ retCode = NwdConvertNetwareHandle(&data, dh);
|
|
break;
|
|
|
|
case NWC_SET_PRIMARY_CONN:
|
|
DbgIocCall("NwcSetPrimaryConn");
|
|
- retCode =
|
|
- novfs_set_pri_conn(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_set_pri_conn(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_PRIMARY_CONN:
|
|
DbgIocCall("NwcGetPrimaryConn");
|
|
- retCode =
|
|
- novfs_get_pri_conn(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_get_pri_conn(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_MAP_DRIVE:
|
|
DbgIocCall("NwcMapDrive");
|
|
- retCode =
|
|
- set_map_drive(&data, dh->session);
|
|
+ retCode = set_map_drive(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_UNMAP_DRIVE:
|
|
DbgIocCall("NwcUnMapDrive");
|
|
- retCode =
|
|
- unmap_drive(&data, dh->session);
|
|
+ retCode = unmap_drive(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_ENUMERATE_DRIVES:
|
|
DbgIocCall("NwcEnumerateDrives");
|
|
- retCode =
|
|
- novfs_enum_drives(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_enum_drives(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_GET_MOUNT_PATH:
|
|
@@ -1730,22 +1568,17 @@ int novfs_daemon_lib_ioctl(struct inode
|
|
|
|
case NWC_GET_BROADCAST_MESSAGE:
|
|
DbgIocCall("NwdGetBroadcastMessage");
|
|
- retCode =
|
|
- novfs_get_bcast_msg(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_get_bcast_msg(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_SET_KEY:
|
|
DbgIocCall("NwdSetKey");
|
|
- retCode =
|
|
- novfs_set_key_value(&data, dh->session);
|
|
+ retCode = novfs_set_key_value(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_VERIFY_KEY:
|
|
DbgIocCall("NwdVerifyKey");
|
|
- retCode =
|
|
- novfs_verify_key_value(&data,
|
|
- dh->session);
|
|
+ retCode = novfs_verify_key_value(&data, dh->session);
|
|
break;
|
|
|
|
case NWC_RAW_NCP_REQUEST_ALL:
|
|
@@ -1757,8 +1590,7 @@ int novfs_daemon_lib_ioctl(struct inode
|
|
|
|
}
|
|
|
|
- DbgPrint("[NOVFS XPLAT] status Code = %X\n",
|
|
- retCode);
|
|
+ DbgPrint("[NOVFS XPLAT] status Code = %X\n", retCode);
|
|
break;
|
|
}
|
|
}
|
|
@@ -1767,8 +1599,7 @@ int novfs_daemon_lib_ioctl(struct inode
|
|
return (retCode);
|
|
}
|
|
|
|
-unsigned int novfs_daemon_poll(struct file *file,
|
|
- struct poll_table_struct *poll_table)
|
|
+unsigned int novfs_daemon_poll(struct file *file, struct poll_table_struct *poll_table)
|
|
{
|
|
struct daemon_cmd *que;
|
|
unsigned int mask = POLLOUT | POLLWRNORM;
|
|
@@ -1779,7 +1610,7 @@ unsigned int novfs_daemon_poll(struct fi
|
|
return mask;
|
|
}
|
|
|
|
-static int NwdConvertNetwareHandle(struct novfs_xplat *pdata, struct daemon_handle * DHandle)
|
|
+static int NwdConvertNetwareHandle(struct novfs_xplat *pdata, struct daemon_handle *DHandle)
|
|
{
|
|
int retVal;
|
|
struct nwc_convert_netware_handle nh;
|
|
@@ -1787,20 +1618,16 @@ static int NwdConvertNetwareHandle(struc
|
|
|
|
DbgPrint("DHandle=0x%p", DHandle);
|
|
|
|
- cpylen =
|
|
- copy_from_user(&nh, pdata->reqData,
|
|
- sizeof(struct nwc_convert_netware_handle));
|
|
+ cpylen = copy_from_user(&nh, pdata->reqData, sizeof(struct nwc_convert_netware_handle));
|
|
|
|
retVal =
|
|
daemon_added_resource(DHandle, DH_TYPE_STREAM,
|
|
- Uint32toHandle(nh.ConnHandle),
|
|
- nh.NetWareHandle, nh.uAccessMode,
|
|
- nh.uFileSize);
|
|
+ Uint32toHandle(nh.ConnHandle), nh.NetWareHandle, nh.uAccessMode, nh.uFileSize);
|
|
|
|
return (retVal);
|
|
}
|
|
|
|
-static int NwdConvertLocalHandle(struct novfs_xplat *pdata, struct daemon_handle * DHandle)
|
|
+static int NwdConvertLocalHandle(struct novfs_xplat *pdata, struct daemon_handle *DHandle)
|
|
{
|
|
int retVal = NWE_REQUESTER_FAILURE;
|
|
struct daemon_resource *resource;
|
|
@@ -1816,14 +1643,12 @@ static int NwdConvertLocalHandle(struct
|
|
resource = list_entry(l, struct daemon_resource, list);
|
|
|
|
if (DH_TYPE_STREAM == resource->type) {
|
|
- lh.uConnReference =
|
|
- HandletoUint32(resource->connection);
|
|
+ lh.uConnReference = HandletoUint32(resource->connection);
|
|
|
|
//sgled memcpy(lh.NwWareHandle, resource->handle, sizeof(resource->handle));
|
|
memcpy(lh.NetWareHandle, resource->handle, sizeof(resource->handle)); //sgled
|
|
if (pdata->repLen >= sizeof(struct nwc_convert_local_handle)) {
|
|
- cpylen = copy_to_user(pdata->repData, &lh,
|
|
- sizeof(struct nwc_convert_local_handle));
|
|
+ cpylen = copy_to_user(pdata->repData, &lh, sizeof(struct nwc_convert_local_handle));
|
|
retVal = 0;
|
|
} else {
|
|
retVal = NWE_BUFFER_OVERFLOW;
|
|
@@ -1855,9 +1680,7 @@ static int NwdGetMountPath(struct novfs_
|
|
retVal = NWE_BUFFER_OVERFLOW;
|
|
} else {
|
|
if (mp.pMountPath) {
|
|
- cpylen =
|
|
- copy_to_user(mp.pMountPath,
|
|
- novfs_current_mnt, len);
|
|
+ cpylen = copy_to_user(mp.pMountPath, novfs_current_mnt, len);
|
|
}
|
|
retVal = 0;
|
|
}
|
|
@@ -1888,8 +1711,7 @@ static int set_map_drive(struct novfs_xp
|
|
return -EFAULT;
|
|
if (symInfo.linkOffsetLength > MAX_NAME_LEN)
|
|
return -EINVAL;
|
|
- drivemap = kmalloc(sizeof(struct drive_map) + symInfo.linkOffsetLength,
|
|
- GFP_KERNEL);
|
|
+ drivemap = kmalloc(sizeof(struct drive_map) + symInfo.linkOffsetLength, GFP_KERNEL);
|
|
if (!drivemap)
|
|
return -ENOMEM;
|
|
|
|
@@ -1898,22 +1720,19 @@ static int set_map_drive(struct novfs_xp
|
|
cpylen = copy_from_user(drivemap->name, path, symInfo.linkOffsetLength);
|
|
|
|
drivemap->session = Session;
|
|
- drivemap->hash = full_name_hash(drivemap->name,
|
|
- symInfo.linkOffsetLength - 1);
|
|
+ drivemap->hash = full_name_hash(drivemap->name, symInfo.linkOffsetLength - 1);
|
|
drivemap->namelen = symInfo.linkOffsetLength - 1;
|
|
DbgPrint("hash=0x%lx path=%s", drivemap->hash, drivemap->name);
|
|
|
|
- dm = (struct drive_map *) & DriveMapList.next;
|
|
+ dm = (struct drive_map *)&DriveMapList.next;
|
|
|
|
down(&DriveMapLock);
|
|
|
|
list_for_each(list, &DriveMapList) {
|
|
dm = list_entry(list, struct drive_map, list);
|
|
__DbgPrint("%s: dm=0x%p\n"
|
|
- " hash: 0x%lx\n"
|
|
- " namelen: %d\n"
|
|
- " name: %s\n", __func__,
|
|
- dm, dm->hash, dm->namelen, dm->name);
|
|
+ " hash: 0x%lx\n"
|
|
+ " namelen: %d\n" " name: %s\n", __func__, dm, dm->hash, dm->namelen, dm->name);
|
|
|
|
if (drivemap->hash == dm->hash) {
|
|
if (0 == strcmp(dm->name, drivemap->name)) {
|
|
@@ -1926,15 +1745,12 @@ static int set_map_drive(struct novfs_xp
|
|
}
|
|
|
|
if (dm) {
|
|
- if ((dm == (struct drive_map *) & DriveMapList) ||
|
|
- (dm->hash < drivemap->hash)) {
|
|
+ if ((dm == (struct drive_map *)&DriveMapList) || (dm->hash < drivemap->hash)) {
|
|
list_add(&drivemap->list, &dm->list);
|
|
} else {
|
|
- list_add_tail(&drivemap->list,
|
|
- &dm->list);
|
|
+ list_add_tail(&drivemap->list, &dm->list);
|
|
}
|
|
- }
|
|
- else
|
|
+ } else
|
|
kfree(drivemap);
|
|
up(&DriveMapLock);
|
|
return (retVal);
|
|
@@ -1949,7 +1765,6 @@ static int unmap_drive(struct novfs_xpla
|
|
struct list_head *list;
|
|
unsigned long hash;
|
|
|
|
-
|
|
retVal = novfs_unmap_drive(pdata, Session);
|
|
if (retVal)
|
|
return retVal;
|
|
@@ -1960,7 +1775,7 @@ static int unmap_drive(struct novfs_xpla
|
|
path = kmalloc(symInfo.linkLen, GFP_KERNEL);
|
|
if (!path)
|
|
return -ENOMEM;
|
|
- if (copy_from_user(path,((struct nwc_unmap_drive_ex *) pdata->reqData)->linkData, symInfo.linkLen)) {
|
|
+ if (copy_from_user(path, ((struct nwc_unmap_drive_ex *)pdata->reqData)->linkData, symInfo.linkLen)) {
|
|
kfree(path);
|
|
return -EFAULT;
|
|
}
|
|
@@ -1975,9 +1790,7 @@ static int unmap_drive(struct novfs_xpla
|
|
list_for_each(list, &DriveMapList) {
|
|
dm = list_entry(list, struct drive_map, list);
|
|
__DbgPrint("%s: dm=0x%p %s\n"
|
|
- " hash: 0x%x\n"
|
|
- " namelen: %d\n", __func__,
|
|
- dm, dm->name, dm->hash, dm->namelen);
|
|
+ " hash: 0x%x\n" " namelen: %d\n", __func__, dm, dm->name, dm->hash, dm->namelen);
|
|
|
|
if (hash == dm->hash) {
|
|
if (0 == strcmp(dm->name, path)) {
|
|
@@ -1991,9 +1804,7 @@ static int unmap_drive(struct novfs_xpla
|
|
|
|
if (dm) {
|
|
__DbgPrint("%s: Remove dm=0x%p %s\n"
|
|
- " hash: 0x%x\n"
|
|
- " namelen: %d\n", __func__,
|
|
- dm, dm->name, dm->hash, dm->namelen);
|
|
+ " hash: 0x%x\n" " namelen: %d\n", __func__, dm, dm->name, dm->hash, dm->namelen);
|
|
list_del(&dm->list);
|
|
kfree(dm);
|
|
}
|
|
@@ -2012,10 +1823,8 @@ static void RemoveDriveMaps(void)
|
|
dm = list_entry(list, struct drive_map, list);
|
|
|
|
__DbgPrint("%s: dm=0x%p\n"
|
|
- " hash: 0x%x\n"
|
|
- " namelen: %d\n"
|
|
- " name: %s\n", __func__,
|
|
- dm, dm->hash, dm->namelen, dm->name);
|
|
+ " hash: 0x%x\n"
|
|
+ " namelen: %d\n" " name: %s\n", __func__, dm, dm->hash, dm->namelen, dm->name);
|
|
local_unlink(dm->name);
|
|
list = list->prev;
|
|
list_del(&dm->list);
|
|
@@ -2044,10 +1853,10 @@ static long local_unlink(const char *pat
|
|
goto exit1;
|
|
mutex_lock(&nd.path.dentry->d_inode->i_mutex);
|
|
/* Get the filename of pathname */
|
|
- name=c=(char *)pathname;
|
|
- while (*c!='\0') {
|
|
- if (*c=='/')
|
|
- name=++c;
|
|
+ name = c = (char *)pathname;
|
|
+ while (*c != '\0') {
|
|
+ if (*c == '/')
|
|
+ name = ++c;
|
|
c++;
|
|
}
|
|
dentry = lookup_one_len(name, nd.path.dentry, strlen(name));
|
|
@@ -2057,7 +1866,7 @@ static long local_unlink(const char *pat
|
|
DbgPrint("dentry %p", dentry);
|
|
if (!(dentry->d_inode->i_mode & S_IFLNK)) {
|
|
DbgPrint("%s not a link", name);
|
|
- error=-ENOENT;
|
|
+ error = -ENOENT;
|
|
goto exit1;
|
|
}
|
|
/* Why not before? Because we want correct error value */
|
|
@@ -2072,7 +1881,7 @@ static long local_unlink(const char *pat
|
|
goto exit2;
|
|
error = vfs_unlink(nd.path.dentry->d_inode, dentry);
|
|
mnt_drop_write(nd.path.mnt);
|
|
- exit2:
|
|
+exit2:
|
|
dput(dentry);
|
|
}
|
|
mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
|
|
@@ -2084,8 +1893,6 @@ exit1:
|
|
return error;
|
|
|
|
slashes:
|
|
- error = !dentry->d_inode ? -ENOENT :
|
|
- S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR;
|
|
+ error = !dentry->d_inode ? -ENOENT : S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR;
|
|
goto exit2;
|
|
}
|
|
-
|
|
--- a/fs/novfs/file.c
|
|
+++ b/fs/novfs/file.c
|
|
@@ -27,11 +27,11 @@
|
|
#include "commands.h"
|
|
#include "nwerror.h"
|
|
|
|
-static ssize_t novfs_tree_read(struct file * file, char *buf, size_t len, loff_t * off);
|
|
+static ssize_t novfs_tree_read(struct file *file, char *buf, size_t len, loff_t * off);
|
|
extern struct dentry_operations novfs_dentry_operations;
|
|
|
|
static struct file_operations novfs_tree_operations = {
|
|
- read:novfs_tree_read,
|
|
+read: novfs_tree_read,
|
|
};
|
|
|
|
/*
|
|
@@ -44,7 +44,7 @@ static int StripTrailingDots = 1;
|
|
int novfs_get_alltrees(struct dentry *parent)
|
|
{
|
|
unsigned char *p;
|
|
- struct novfs_command_reply_header * reply = NULL;
|
|
+ struct novfs_command_reply_header *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
struct novfs_command_request_header cmd;
|
|
int retCode;
|
|
@@ -63,8 +63,7 @@ int novfs_get_alltrees(struct dentry *pa
|
|
DbgPrint("reply=0x%p replylen=%d", reply, replylen);
|
|
if (reply) {
|
|
novfs_dump(replylen, reply);
|
|
- if (!reply->ErrorCode
|
|
- && (replylen > sizeof(struct novfs_command_reply_header))) {
|
|
+ if (!reply->ErrorCode && (replylen > sizeof(struct novfs_command_reply_header))) {
|
|
p = (char *)reply + 8;
|
|
while (*p) {
|
|
DbgPrint("%s", p);
|
|
@@ -92,7 +91,7 @@ int novfs_get_alltrees(struct dentry *pa
|
|
return (retCode);
|
|
}
|
|
|
|
-static ssize_t novfs_tree_read(struct file * file, char *buf, size_t len, loff_t * off)
|
|
+static ssize_t novfs_tree_read(struct file *file, char *buf, size_t len, loff_t * off)
|
|
{
|
|
if (file->f_pos != 0) {
|
|
return (0);
|
|
@@ -103,7 +102,7 @@ static ssize_t novfs_tree_read(struct fi
|
|
return (5);
|
|
}
|
|
|
|
-int novfs_get_servers(unsigned char ** ServerList, struct novfs_schandle SessionId)
|
|
+int novfs_get_servers(unsigned char **ServerList, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_get_connected_server_list req;
|
|
struct novfs_get_connected_server_list_reply *reply = NULL;
|
|
@@ -115,15 +114,13 @@ int novfs_get_servers(unsigned char ** S
|
|
req.Command.CommandType = VFS_COMMAND_GET_CONNECTED_SERVER_LIST;
|
|
req.Command.SessionId = SessionId;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&req, sizeof(req), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&req, sizeof(req), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
DbgPrint("reply");
|
|
replylen -= sizeof(struct novfs_command_reply_header);
|
|
if (!reply->Reply.ErrorCode && replylen) {
|
|
memcpy(reply, reply->List, replylen);
|
|
- *ServerList = (unsigned char *) reply;
|
|
+ *ServerList = (unsigned char *)reply;
|
|
retCode = 0;
|
|
} else {
|
|
kfree(reply);
|
|
@@ -133,8 +130,7 @@ int novfs_get_servers(unsigned char ** S
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_get_vols(struct qstr *Server, unsigned char ** VolumeList,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_get_vols(struct qstr *Server, unsigned char **VolumeList, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_get_server_volume_list *req;
|
|
struct novfs_get_server_volume_list_reply *reply = NULL;
|
|
@@ -151,9 +147,7 @@ int novfs_get_vols(struct qstr *Server,
|
|
memcpy(req->Name, Server->name, Server->len);
|
|
req->Command.SessionId = SessionId;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(req, reqlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(req, reqlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
DbgPrint("reply");
|
|
novfs_dump(replylen, reply);
|
|
@@ -161,7 +155,7 @@ int novfs_get_vols(struct qstr *Server,
|
|
|
|
if (!reply->Reply.ErrorCode && replylen) {
|
|
memcpy(reply, reply->List, replylen);
|
|
- *VolumeList = (unsigned char *) reply;
|
|
+ *VolumeList = (unsigned char *)reply;
|
|
retCode = 0;
|
|
} else {
|
|
kfree(reply);
|
|
@@ -172,11 +166,11 @@ int novfs_get_vols(struct qstr *Server,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_get_file_info(unsigned char * Path, struct novfs_entry_info * Info, struct novfs_schandle SessionId)
|
|
+int novfs_get_file_info(unsigned char *Path, struct novfs_entry_info *Info, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_verify_file_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
- struct novfs_verify_file_request * cmd;
|
|
+ struct novfs_verify_file_request *cmd;
|
|
int cmdlen;
|
|
int retCode = -ENOENT;
|
|
int pathlen;
|
|
@@ -195,7 +189,7 @@ int novfs_get_file_info(unsigned char *
|
|
if ('.' == Path[pathlen - 1])
|
|
pathlen--;
|
|
}
|
|
- cmdlen = offsetof(struct novfs_verify_file_request,path) + pathlen;
|
|
+ cmdlen = offsetof(struct novfs_verify_file_request, path) + pathlen;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_VERIFY_FILE;
|
|
@@ -204,10 +198,7 @@ int novfs_get_file_info(unsigned char *
|
|
cmd->pathLen = pathlen;
|
|
memcpy(cmd->path, Path, cmd->pathLen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0,
|
|
- (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
|
|
@@ -217,38 +208,31 @@ int novfs_get_file_info(unsigned char *
|
|
Info->type = 3;
|
|
Info->mode = S_IRWXU;
|
|
|
|
- if (reply->
|
|
- fileMode & NW_ATTRIBUTE_DIRECTORY) {
|
|
+ if (reply->fileMode & NW_ATTRIBUTE_DIRECTORY) {
|
|
Info->mode |= S_IFDIR;
|
|
} else {
|
|
Info->mode |= S_IFREG;
|
|
}
|
|
|
|
- if (reply->
|
|
- fileMode & NW_ATTRIBUTE_READ_ONLY) {
|
|
+ if (reply->fileMode & NW_ATTRIBUTE_READ_ONLY) {
|
|
Info->mode &= ~(S_IWUSR);
|
|
}
|
|
|
|
Info->uid = current_euid();
|
|
Info->gid = current_egid();
|
|
Info->size = reply->fileSize;
|
|
- Info->atime.tv_sec =
|
|
- reply->lastAccessTime;
|
|
+ Info->atime.tv_sec = reply->lastAccessTime;
|
|
Info->atime.tv_nsec = 0;
|
|
Info->mtime.tv_sec = reply->modifyTime;
|
|
Info->mtime.tv_nsec = 0;
|
|
Info->ctime.tv_sec = reply->createTime;
|
|
Info->ctime.tv_nsec = 0;
|
|
DbgPrint("replylen=%d sizeof(VERIFY_FILE_REPLY)=%d",
|
|
- replylen,
|
|
- sizeof(struct novfs_verify_file_reply));
|
|
- if (replylen >
|
|
- sizeof(struct novfs_verify_file_reply)) {
|
|
- unsigned int *lp =
|
|
- &reply->fileMode;
|
|
+ replylen, sizeof(struct novfs_verify_file_reply));
|
|
+ if (replylen > sizeof(struct novfs_verify_file_reply)) {
|
|
+ unsigned int *lp = &reply->fileMode;
|
|
lp++;
|
|
- DbgPrint("extra data 0x%x",
|
|
- *lp);
|
|
+ DbgPrint("extra data 0x%x", *lp);
|
|
Info->mtime.tv_nsec = *lp;
|
|
}
|
|
retCode = 0;
|
|
@@ -265,8 +249,7 @@ int novfs_get_file_info(unsigned char *
|
|
}
|
|
|
|
int novfs_getx_file_info(char *Path, const char *Name, char *buffer,
|
|
- ssize_t buffer_size, ssize_t * dataLen,
|
|
- struct novfs_schandle SessionId)
|
|
+ ssize_t buffer_size, ssize_t * dataLen, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_xa_get_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
@@ -277,14 +260,13 @@ int novfs_getx_file_info(char *Path, con
|
|
int namelen = strlen(Name);
|
|
int pathlen = strlen(Path);
|
|
|
|
- DbgPrint("xattr: Path = %s, pathlen = %i, Name = %s, namelen = %i",
|
|
- Path, pathlen, Name, namelen);
|
|
+ DbgPrint("xattr: Path = %s, pathlen = %i, Name = %s, namelen = %i", Path, pathlen, Name, namelen);
|
|
|
|
if (namelen > MAX_XATTR_NAME_LEN)
|
|
return -ENOATTR;
|
|
|
|
- cmdlen = offsetof(struct novfs_xa_get_request, data) + pathlen + 1 + namelen + 1; // two '\0'
|
|
- cmd = (struct novfs_xa_get_request *) kmalloc(cmdlen, GFP_KERNEL);
|
|
+ cmdlen = offsetof(struct novfs_xa_get_request, data)+pathlen + 1 + namelen + 1; // two '\0'
|
|
+ cmd = (struct novfs_xa_get_request *)kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_GET_EXTENDED_ATTRIBUTE;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -297,35 +279,27 @@ int novfs_getx_file_info(char *Path, con
|
|
memcpy(cmd->data + cmd->pathLen + 1, Name, cmd->nameLen + 1);
|
|
|
|
DbgPrint("xattr: PXA_GET_REQUEST BEGIN");
|
|
- DbgPrint("xattr: Queue_Daemon_Command %d",
|
|
- cmd->Command.CommandType);
|
|
- DbgPrint("xattr: Command.SessionId = %d",
|
|
- cmd->Command.SessionId);
|
|
+ DbgPrint("xattr: Queue_Daemon_Command %d", cmd->Command.CommandType);
|
|
+ DbgPrint("xattr: Command.SessionId = %d", cmd->Command.SessionId);
|
|
DbgPrint("xattr: pathLen = %d", cmd->pathLen);
|
|
DbgPrint("xattr: Path = %s", cmd->data);
|
|
DbgPrint("xattr: nameLen = %d", cmd->nameLen);
|
|
DbgPrint("xattr: name = %s", (cmd->data + cmd->pathLen + 1));
|
|
DbgPrint("xattr: PXA_GET_REQUEST END");
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
|
|
if (reply->Reply.ErrorCode) {
|
|
- DbgPrint("xattr: reply->Reply.ErrorCode=%d, %X",
|
|
- reply->Reply.ErrorCode,
|
|
- reply->Reply.ErrorCode);
|
|
+ DbgPrint("xattr: reply->Reply.ErrorCode=%d, %X", reply->Reply.ErrorCode, reply->Reply.ErrorCode);
|
|
DbgPrint("xattr: replylen=%d", replylen);
|
|
|
|
retCode = -ENOATTR;
|
|
} else {
|
|
|
|
- *dataLen =
|
|
- replylen - sizeof(struct novfs_command_reply_header);
|
|
- DbgPrint("xattr: replylen=%u, dataLen=%u",
|
|
- replylen, *dataLen);
|
|
+ *dataLen = replylen - sizeof(struct novfs_command_reply_header);
|
|
+ DbgPrint("xattr: replylen=%u, dataLen=%u", replylen, *dataLen);
|
|
|
|
if (buffer_size >= *dataLen) {
|
|
DbgPrint("xattr: copying to buffer from &reply->pData");
|
|
@@ -353,8 +327,7 @@ int novfs_getx_file_info(char *Path, con
|
|
}
|
|
|
|
int novfs_setx_file_info(char *Path, const char *Name, const void *Value,
|
|
- unsigned long valueLen, unsigned long *bytesWritten,
|
|
- int flags, struct novfs_schandle SessionId)
|
|
+ unsigned long valueLen, unsigned long *bytesWritten, int flags, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_xa_set_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
@@ -371,8 +344,8 @@ int novfs_setx_file_info(char *Path, con
|
|
if (namelen > MAX_XATTR_NAME_LEN)
|
|
return -ENOATTR;
|
|
|
|
- cmdlen = offsetof(struct novfs_xa_set_request, data) + pathlen + 1 + namelen + 1 + valueLen;
|
|
- cmd = (struct novfs_xa_set_request *) kmalloc(cmdlen, GFP_KERNEL);
|
|
+ cmdlen = offsetof(struct novfs_xa_set_request, data)+pathlen + 1 + namelen + 1 + valueLen;
|
|
+ cmd = (struct novfs_xa_set_request *)kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_SET_EXTENDED_ATTRIBUTE;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -386,14 +359,11 @@ int novfs_setx_file_info(char *Path, con
|
|
memcpy(cmd->data + cmd->pathLen + 1, Name, cmd->nameLen + 1);
|
|
|
|
cmd->valueLen = valueLen;
|
|
- memcpy(cmd->data + cmd->pathLen + 1 + cmd->nameLen + 1, Value,
|
|
- valueLen);
|
|
+ memcpy(cmd->data + cmd->pathLen + 1 + cmd->nameLen + 1, Value, valueLen);
|
|
|
|
DbgPrint("xattr: PXA_SET_REQUEST BEGIN");
|
|
- DbgPrint("attr: Queue_Daemon_Command %d",
|
|
- cmd->Command.CommandType);
|
|
- DbgPrint("xattr: Command.SessionId = %d",
|
|
- cmd->Command.SessionId);
|
|
+ DbgPrint("attr: Queue_Daemon_Command %d", cmd->Command.CommandType);
|
|
+ DbgPrint("xattr: Command.SessionId = %d", cmd->Command.SessionId);
|
|
DbgPrint("xattr: pathLen = %d", cmd->pathLen);
|
|
DbgPrint("xattr: Path = %s", cmd->data);
|
|
DbgPrint("xattr: nameLen = %d", cmd->nameLen);
|
|
@@ -402,26 +372,20 @@ int novfs_setx_file_info(char *Path, con
|
|
|
|
DbgPrint("xattr: PXA_SET_REQUEST END");
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
|
|
if (reply->Reply.ErrorCode) {
|
|
- DbgPrint("xattr: reply->Reply.ErrorCode=%d, %X",
|
|
- reply->Reply.ErrorCode,
|
|
- reply->Reply.ErrorCode);
|
|
+ DbgPrint("xattr: reply->Reply.ErrorCode=%d, %X", reply->Reply.ErrorCode, reply->Reply.ErrorCode);
|
|
DbgPrint("xattr: replylen=%d", replylen);
|
|
|
|
retCode = -reply->Reply.ErrorCode; //-ENOENT;
|
|
} else {
|
|
|
|
DbgPrint("xattr: replylen=%u, real len = %u",
|
|
- replylen,
|
|
- replylen - sizeof(struct novfs_command_reply_header));
|
|
- memcpy(bytesWritten, &reply->pData,
|
|
- replylen - sizeof(struct novfs_command_reply_header));
|
|
+ replylen, replylen - sizeof(struct novfs_command_reply_header));
|
|
+ memcpy(bytesWritten, &reply->pData, replylen - sizeof(struct novfs_command_reply_header));
|
|
|
|
retCode = 0;
|
|
}
|
|
@@ -437,8 +401,7 @@ int novfs_setx_file_info(char *Path, con
|
|
return retCode;
|
|
}
|
|
|
|
-int novfs_listx_file_info(char *Path, char *buffer, ssize_t buffer_size,
|
|
- ssize_t * dataLen, struct novfs_schandle SessionId)
|
|
+int novfs_listx_file_info(char *Path, char *buffer, ssize_t buffer_size, ssize_t * dataLen, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_xa_list_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
@@ -451,7 +414,7 @@ int novfs_listx_file_info(char *Path, ch
|
|
|
|
*dataLen = 0;
|
|
cmdlen = offsetof(struct novfs_verify_file_request, path) + pathlen;
|
|
- cmd = (struct novfs_verify_file_request *) kmalloc(cmdlen, GFP_KERNEL);
|
|
+ cmd = (struct novfs_verify_file_request *)kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_LIST_EXTENDED_ATTRIBUTES;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -459,40 +422,30 @@ int novfs_listx_file_info(char *Path, ch
|
|
cmd->pathLen = pathlen;
|
|
memcpy(cmd->path, Path, cmd->pathLen + 1); //+ '\0'
|
|
DbgPrint("xattr: PVERIFY_FILE_REQUEST BEGIN");
|
|
- DbgPrint("xattr: Queue_Daemon_Command %d",
|
|
- cmd->Command.CommandType);
|
|
- DbgPrint("xattr: Command.SessionId = %d",
|
|
- cmd->Command.SessionId);
|
|
+ DbgPrint("xattr: Queue_Daemon_Command %d", cmd->Command.CommandType);
|
|
+ DbgPrint("xattr: Command.SessionId = %d", cmd->Command.SessionId);
|
|
DbgPrint("xattr: pathLen = %d", cmd->pathLen);
|
|
DbgPrint("xattr: Path = %s", cmd->path);
|
|
DbgPrint("xattr: PVERIFY_FILE_REQUEST END");
|
|
|
|
- retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0,
|
|
- (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
|
|
if (reply->Reply.ErrorCode) {
|
|
- DbgPrint("xattr: reply->Reply.ErrorCode=%d, %X",
|
|
- reply->Reply.ErrorCode,
|
|
- reply->Reply.ErrorCode);
|
|
+ DbgPrint("xattr: reply->Reply.ErrorCode=%d, %X", reply->Reply.ErrorCode, reply->Reply.ErrorCode);
|
|
DbgPrint("xattr: replylen=%d", replylen);
|
|
|
|
retCode = -ENOENT;
|
|
} else {
|
|
- *dataLen =
|
|
- replylen - sizeof(struct novfs_command_reply_header);
|
|
- DbgPrint("xattr: replylen=%u, dataLen=%u",
|
|
- replylen, *dataLen);
|
|
+ *dataLen = replylen - sizeof(struct novfs_command_reply_header);
|
|
+ DbgPrint("xattr: replylen=%u, dataLen=%u", replylen, *dataLen);
|
|
|
|
if (buffer_size >= *dataLen) {
|
|
- DbgPrint("xattr: copying to buffer "
|
|
- "from &reply->pData");
|
|
+ DbgPrint("xattr: copying to buffer " "from &reply->pData");
|
|
memcpy(buffer, &reply->pData, *dataLen);
|
|
} else {
|
|
- DbgPrint("xattr: (!!!) buffer is "
|
|
- "smaller then reply\n");
|
|
+ DbgPrint("xattr: (!!!) buffer is " "smaller then reply\n");
|
|
retCode = -ERANGE;
|
|
}
|
|
DbgPrint("xattr: /dumping buffer");
|
|
@@ -513,8 +466,7 @@ int novfs_listx_file_info(char *Path, ch
|
|
return retCode;
|
|
}
|
|
|
|
-static int begin_directory_enumerate(unsigned char * Path, int PathLen, void ** EnumHandle,
|
|
- struct novfs_schandle SessionId)
|
|
+static int begin_directory_enumerate(unsigned char *Path, int PathLen, void **EnumHandle, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_begin_enumerate_directory_request *cmd;
|
|
struct novfs_begin_enumerate_directory_reply *reply = NULL;
|
|
@@ -524,7 +476,7 @@ static int begin_directory_enumerate(uns
|
|
*EnumHandle = 0;
|
|
|
|
cmdlen = offsetof(struct
|
|
- novfs_begin_enumerate_directory_request, path) + PathLen;
|
|
+ novfs_begin_enumerate_directory_request, path) + PathLen;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_START_ENUMERATE;
|
|
@@ -534,9 +486,7 @@ static int begin_directory_enumerate(uns
|
|
cmd->pathLen = PathLen;
|
|
memcpy(cmd->path, Path, PathLen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
/*
|
|
* retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, 0);
|
|
*/
|
|
@@ -569,9 +519,7 @@ int novfs_end_directory_enumerate(void *
|
|
|
|
cmd.enumerateHandle = EnumHandle;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, 0);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, 0);
|
|
if (reply) {
|
|
retCode = 0;
|
|
if (reply->Reply.ErrorCode) {
|
|
@@ -583,14 +531,14 @@ int novfs_end_directory_enumerate(void *
|
|
return (retCode);
|
|
}
|
|
|
|
-static int directory_enumerate_ex(void ** EnumHandle, struct novfs_schandle SessionId, int *Count,
|
|
- struct novfs_entry_info **PInfo, int Interrupt)
|
|
+static int directory_enumerate_ex(void **EnumHandle, struct novfs_schandle SessionId, int *Count,
|
|
+ struct novfs_entry_info **PInfo, int Interrupt)
|
|
{
|
|
struct novfs_enumerate_directory_ex_request cmd;
|
|
struct novfs_enumerate_directory_ex_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
int retCode = 0;
|
|
- struct novfs_entry_info * info;
|
|
+ struct novfs_entry_info *info;
|
|
struct novfs_enumerate_directory_ex_data *data;
|
|
int isize;
|
|
|
|
@@ -606,9 +554,7 @@ static int directory_enumerate_ex(void *
|
|
cmd.pathLen = 0;
|
|
cmd.path[0] = '\0';
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, Interrupt);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, Interrupt);
|
|
|
|
if (reply) {
|
|
retCode = 0;
|
|
@@ -617,88 +563,60 @@ static int directory_enumerate_ex(void *
|
|
* error but there could still be valid data.
|
|
*/
|
|
|
|
- if (!reply->Reply.ErrorCode ||
|
|
- ((replylen > sizeof(struct novfs_command_reply_header)) &&
|
|
- (reply->enumCount > 0))) {
|
|
+ if (!reply->Reply.ErrorCode || ((replylen > sizeof(struct novfs_command_reply_header)) && (reply->enumCount > 0))) {
|
|
DbgPrint("isize=%d", replylen);
|
|
data =
|
|
- (struct novfs_enumerate_directory_ex_data *) ((char *)reply +
|
|
- sizeof
|
|
- (struct novfs_enumerate_directory_ex_reply));
|
|
- isize =
|
|
- replylen - sizeof(struct novfs_enumerate_directory_ex_reply *) -
|
|
- reply->enumCount *
|
|
- offsetof(struct
|
|
- novfs_enumerate_directory_ex_data, name);
|
|
- isize +=
|
|
- (reply->enumCount *
|
|
- offsetof(struct novfs_entry_info, name));
|
|
+ (struct novfs_enumerate_directory_ex_data *)((char *)reply +
|
|
+ sizeof(struct novfs_enumerate_directory_ex_reply));
|
|
+ isize = replylen - sizeof(struct novfs_enumerate_directory_ex_reply *) - reply->enumCount * offsetof(struct
|
|
+ novfs_enumerate_directory_ex_data,
|
|
+ name);
|
|
+ isize += (reply->enumCount * offsetof(struct novfs_entry_info, name));
|
|
|
|
if (PInfo) {
|
|
*PInfo = info = kmalloc(isize, GFP_KERNEL);
|
|
if (*PInfo) {
|
|
- DbgPrint("data=0x%p info=0x%p",
|
|
- data, info);
|
|
+ DbgPrint("data=0x%p info=0x%p", data, info);
|
|
*Count = reply->enumCount;
|
|
do {
|
|
- DbgPrint("data=0x%p length=%d",
|
|
- data);
|
|
+ DbgPrint("data=0x%p length=%d", data);
|
|
|
|
info->type = 3;
|
|
info->mode = S_IRWXU;
|
|
|
|
- if (data->
|
|
- mode &
|
|
- NW_ATTRIBUTE_DIRECTORY) {
|
|
+ if (data->mode & NW_ATTRIBUTE_DIRECTORY) {
|
|
info->mode |= S_IFDIR;
|
|
info->mode |= S_IXUSR;
|
|
} else {
|
|
info->mode |= S_IFREG;
|
|
}
|
|
|
|
- if (data->
|
|
- mode &
|
|
- NW_ATTRIBUTE_READ_ONLY) {
|
|
- info->mode &=
|
|
- ~(S_IWUSR);
|
|
+ if (data->mode & NW_ATTRIBUTE_READ_ONLY) {
|
|
+ info->mode &= ~(S_IWUSR);
|
|
}
|
|
|
|
- if (data->
|
|
- mode & NW_ATTRIBUTE_EXECUTE)
|
|
- {
|
|
+ if (data->mode & NW_ATTRIBUTE_EXECUTE) {
|
|
info->mode |= S_IXUSR;
|
|
}
|
|
|
|
info->uid = current_euid();
|
|
info->gid = current_egid();
|
|
info->size = data->size;
|
|
- info->atime.tv_sec =
|
|
- data->lastAccessTime;
|
|
+ info->atime.tv_sec = data->lastAccessTime;
|
|
info->atime.tv_nsec = 0;
|
|
- info->mtime.tv_sec =
|
|
- data->modifyTime;
|
|
+ info->mtime.tv_sec = data->modifyTime;
|
|
info->mtime.tv_nsec = 0;
|
|
- info->ctime.tv_sec =
|
|
- data->createTime;
|
|
+ info->ctime.tv_sec = data->createTime;
|
|
info->ctime.tv_nsec = 0;
|
|
- info->namelength =
|
|
- data->nameLen;
|
|
- memcpy(info->name, data->name,
|
|
- data->nameLen);
|
|
- data =
|
|
- (struct novfs_enumerate_directory_ex_data *)
|
|
- & data->name[data->nameLen];
|
|
- replylen =
|
|
- (int)((char *)&info->
|
|
- name[info->
|
|
- namelength] -
|
|
- (char *)info);
|
|
+ info->namelength = data->nameLen;
|
|
+ memcpy(info->name, data->name, data->nameLen);
|
|
+ data = (struct novfs_enumerate_directory_ex_data *)
|
|
+ &data->name[data->nameLen];
|
|
+ replylen = (int)((char *)&info->name[info->namelength] - (char *)info);
|
|
DbgPrint("info=0x%p", info);
|
|
novfs_dump(replylen, info);
|
|
|
|
- info =
|
|
- (struct novfs_entry_info *) & info->
|
|
- name[info->namelength];
|
|
+ info = (struct novfs_entry_info *)&info->name[info->namelength];
|
|
|
|
} while (--reply->enumCount);
|
|
}
|
|
@@ -717,9 +635,8 @@ static int directory_enumerate_ex(void *
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_get_dir_listex(unsigned char * Path, void ** EnumHandle, int *Count,
|
|
- struct novfs_entry_info **Info,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_get_dir_listex(unsigned char *Path, void **EnumHandle, int *Count,
|
|
+ struct novfs_entry_info **Info, struct novfs_schandle SessionId)
|
|
{
|
|
int retCode = -ENOENT;
|
|
|
|
@@ -728,20 +645,16 @@ int novfs_get_dir_listex(unsigned char *
|
|
if (Info)
|
|
*Info = NULL;
|
|
|
|
- if ((void *) - 1 == *EnumHandle) {
|
|
+ if ((void *)-1 == *EnumHandle) {
|
|
return (-ENODATA);
|
|
}
|
|
|
|
if (0 == *EnumHandle) {
|
|
- retCode =
|
|
- begin_directory_enumerate(Path, strlen(Path), EnumHandle,
|
|
- SessionId);
|
|
+ retCode = begin_directory_enumerate(Path, strlen(Path), EnumHandle, SessionId);
|
|
}
|
|
|
|
if (*EnumHandle) {
|
|
- retCode =
|
|
- directory_enumerate_ex(EnumHandle, SessionId, Count, Info,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = directory_enumerate_ex(EnumHandle, SessionId, Count, Info, INTERRUPTIBLE);
|
|
if (retCode) {
|
|
novfs_end_directory_enumerate(*EnumHandle, SessionId);
|
|
retCode = 0;
|
|
@@ -751,9 +664,7 @@ int novfs_get_dir_listex(unsigned char *
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_open_file(unsigned char * Path, int Flags, struct novfs_entry_info * Info,
|
|
- void ** Handle,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_open_file(unsigned char *Path, int Flags, struct novfs_entry_info *Info, void **Handle, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_open_file_request *cmd;
|
|
struct novfs_open_file_reply *reply;
|
|
@@ -817,19 +728,15 @@ int novfs_open_file(unsigned char * Path
|
|
cmd->pathLen = pathlen;
|
|
memcpy(cmd->path, Path, pathlen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
if (reply->Reply.ErrorCode) {
|
|
if (NWE_OBJECT_EXISTS == reply->Reply.ErrorCode) {
|
|
retCode = -EEXIST;
|
|
- } else if (NWE_ACCESS_DENIED ==
|
|
- reply->Reply.ErrorCode) {
|
|
+ } else if (NWE_ACCESS_DENIED == reply->Reply.ErrorCode) {
|
|
retCode = -EACCES;
|
|
- } else if (NWE_FILE_IN_USE ==
|
|
- reply->Reply.ErrorCode) {
|
|
+ } else if (NWE_FILE_IN_USE == reply->Reply.ErrorCode) {
|
|
retCode = -EBUSY;
|
|
} else {
|
|
retCode = -ENOENT;
|
|
@@ -847,7 +754,7 @@ int novfs_open_file(unsigned char * Path
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_create(unsigned char * Path, int DirectoryFlag, struct novfs_schandle SessionId)
|
|
+int novfs_create(unsigned char *Path, int DirectoryFlag, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_create_file_request *cmd;
|
|
struct novfs_create_file_reply *reply;
|
|
@@ -875,9 +782,7 @@ int novfs_create(unsigned char * Path, i
|
|
cmd->pathlength = pathlen;
|
|
memcpy(cmd->path, Path, pathlen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
retCode = 0;
|
|
@@ -906,9 +811,7 @@ int novfs_close_file(void *Handle, struc
|
|
|
|
cmd.handle = Handle;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, 0);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, 0);
|
|
if (reply) {
|
|
retCode = 0;
|
|
if (reply->Reply.ErrorCode) {
|
|
@@ -919,11 +822,10 @@ int novfs_close_file(void *Handle, struc
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_read_file(void *Handle, unsigned char * Buffer, size_t * Bytes,
|
|
- loff_t * Offset, struct novfs_schandle SessionId)
|
|
+int novfs_read_file(void *Handle, unsigned char *Buffer, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_read_file_request cmd;
|
|
- struct novfs_read_file_reply * reply = NULL;
|
|
+ struct novfs_read_file_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
int retCode = 0;
|
|
size_t len;
|
|
@@ -931,10 +833,9 @@ int novfs_read_file(void *Handle, unsign
|
|
len = *Bytes;
|
|
*Bytes = 0;
|
|
|
|
- if (offsetof(struct novfs_read_file_reply, data) + len
|
|
- > novfs_max_iosize) {
|
|
+ if (offsetof(struct novfs_read_file_reply, data) + len > novfs_max_iosize) {
|
|
len = novfs_max_iosize - offsetof(struct
|
|
- novfs_read_file_reply, data);
|
|
+ novfs_read_file_reply, data);
|
|
len = (len / PAGE_SIZE) * PAGE_SIZE;
|
|
}
|
|
|
|
@@ -946,9 +847,7 @@ int novfs_read_file(void *Handle, unsign
|
|
cmd.len = len;
|
|
cmd.offset = *Offset;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
DbgPrint("Queue_Daemon_Command 0x%x replylen=%d", retCode, replylen);
|
|
|
|
@@ -961,11 +860,10 @@ int novfs_read_file(void *Handle, unsign
|
|
}
|
|
} else {
|
|
replylen -= offsetof(struct
|
|
- novfs_read_file_reply, data);
|
|
+ novfs_read_file_reply, data);
|
|
|
|
if (replylen > 0) {
|
|
- replylen -=
|
|
- copy_to_user(Buffer, reply->data, replylen);
|
|
+ replylen -= copy_to_user(Buffer, reply->data, replylen);
|
|
*Bytes = replylen;
|
|
}
|
|
}
|
|
@@ -981,11 +879,10 @@ int novfs_read_file(void *Handle, unsign
|
|
}
|
|
|
|
int novfs_read_pages(void *Handle, struct novfs_data_list *DList,
|
|
- int DList_Cnt, size_t * Bytes, loff_t * Offset,
|
|
- struct novfs_schandle SessionId)
|
|
+ int DList_Cnt, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_read_file_request cmd;
|
|
- struct novfs_read_file_reply * reply = NULL;
|
|
+ struct novfs_read_file_reply *reply = NULL;
|
|
struct novfs_read_file_reply lreply;
|
|
unsigned long replylen = 0;
|
|
int retCode = 0;
|
|
@@ -995,8 +892,7 @@ int novfs_read_pages(void *Handle, struc
|
|
*Bytes = 0;
|
|
|
|
DbgPrint("Handle=0x%p Dlst=0x%p Dlcnt=%d Bytes=%d Offset=%lld "
|
|
- "SessionId=0x%p:%p", Handle, DList, DList_Cnt, len, *Offset,
|
|
- SessionId.hTypeId, SessionId.hId);
|
|
+ "SessionId=0x%p:%p", Handle, DList, DList_Cnt, len, *Offset, SessionId.hTypeId, SessionId.hId);
|
|
|
|
cmd.Command.CommandType = VFS_COMMAND_READ_FILE;
|
|
cmd.Command.SequenceNumber = 0;
|
|
@@ -1014,9 +910,7 @@ int novfs_read_pages(void *Handle, struc
|
|
DList[0].len = offsetof(struct novfs_read_file_reply, data);
|
|
DList[0].rwflag = DLWRITE;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), DList, DList_Cnt,
|
|
- (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), DList, DList_Cnt, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
DbgPrint("Queue_Daemon_Command 0x%x", retCode);
|
|
|
|
@@ -1033,7 +927,7 @@ int novfs_read_pages(void *Handle, struc
|
|
}
|
|
}
|
|
*Bytes = replylen - offsetof(struct
|
|
- novfs_read_file_reply, data);
|
|
+ novfs_read_file_reply, data);
|
|
}
|
|
|
|
if (reply) {
|
|
@@ -1045,8 +939,7 @@ int novfs_read_pages(void *Handle, struc
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_write_file(void *Handle, unsigned char * Buffer, size_t * Bytes,
|
|
- loff_t * Offset, struct novfs_schandle SessionId)
|
|
+int novfs_write_file(void *Handle, unsigned char *Buffer, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_write_file_request cmd;
|
|
struct novfs_write_file_reply *reply = NULL;
|
|
@@ -1082,9 +975,7 @@ int novfs_write_file(void *Handle, unsig
|
|
|
|
DbgPrint("cmdlen=%ld len=%ld", cmdlen, len);
|
|
|
|
- npage =
|
|
- (((unsigned long)Buffer & ~PAGE_MASK) + len +
|
|
- (PAGE_SIZE - 1)) >> PAGE_SHIFT;
|
|
+ npage = (((unsigned long)Buffer & ~PAGE_MASK) + len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
|
|
|
|
dlist = kmalloc(sizeof(struct novfs_data_list) * (npage + 1), GFP_KERNEL);
|
|
if (NULL == dlist) {
|
|
@@ -1121,8 +1012,7 @@ int novfs_write_file(void *Handle, unsig
|
|
dlist[0].len = len;
|
|
}
|
|
|
|
- DbgPrint("page=0x%p offset=0x%p len=%d",
|
|
- dlist[0].page, dlist[0].offset, dlist[0].len);
|
|
+ DbgPrint("page=0x%p offset=0x%p len=%d", dlist[0].page, dlist[0].offset, dlist[0].len);
|
|
|
|
boff = dlist[0].len;
|
|
|
|
@@ -1140,8 +1030,7 @@ int novfs_write_file(void *Handle, unsig
|
|
dlist[i].rwflag = DLREAD;
|
|
|
|
boff += dlist[i].len;
|
|
- DbgPrint("%d: page=0x%p offset=0x%p len=%d", i,
|
|
- dlist[i].page, dlist[i].offset, dlist[i].len);
|
|
+ DbgPrint("%d: page=0x%p offset=0x%p len=%d", i, dlist[i].page, dlist[i].offset, dlist[i].len);
|
|
}
|
|
|
|
dlist[i].page = NULL;
|
|
@@ -1152,10 +1041,7 @@ int novfs_write_file(void *Handle, unsig
|
|
|
|
DbgPrint("Buffer=0x%p boff=0x%x len=%d", Buffer, boff, len);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, cmdlen, dlist, res,
|
|
- (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, cmdlen, dlist, res, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
} else {
|
|
char *kdata;
|
|
@@ -1175,10 +1061,7 @@ int novfs_write_file(void *Handle, unsig
|
|
dlist[1].len = sizeof(lreply);
|
|
dlist[1].rwflag = DLWRITE;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, cmdlen, dlist, 2,
|
|
- (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, cmdlen, dlist, 2, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
kfree(kdata);
|
|
}
|
|
@@ -1218,8 +1101,7 @@ int novfs_write_file(void *Handle, unsig
|
|
kfree(pages);
|
|
kfree(dlist);
|
|
|
|
- DbgPrint("*Bytes=0x%x retCode=0x%x", *Bytes,
|
|
- retCode);
|
|
+ DbgPrint("*Bytes=0x%x retCode=0x%x", *Bytes, retCode);
|
|
|
|
return (retCode);
|
|
}
|
|
@@ -1245,8 +1127,7 @@ int novfs_write_page(void *Handle, struc
|
|
int retCode = 0, cmdlen;
|
|
struct novfs_data_list dlst[2];
|
|
|
|
- DbgPrint("Handle=0x%p Page=0x%p Index=%lu SessionId=0x%llx",
|
|
- Handle, Page, Page->index, SessionId);
|
|
+ DbgPrint("Handle=0x%p Page=0x%p Index=%lu SessionId=0x%llx", Handle, Page, Page->index, SessionId);
|
|
|
|
dlst[0].page = NULL;
|
|
dlst[0].offset = &lreply;
|
|
@@ -1268,9 +1149,7 @@ int novfs_write_page(void *Handle, struc
|
|
cmd.len = PAGE_CACHE_SIZE;
|
|
cmd.offset = (loff_t) Page->index << PAGE_CACHE_SHIFT;;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, cmdlen, &dlst, 2, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, cmdlen, &dlst, 2, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (!retCode) {
|
|
if (reply) {
|
|
memcpy(&lreply, reply, sizeof(lreply));
|
|
@@ -1314,8 +1193,7 @@ int novfs_write_pages(void *Handle, stru
|
|
size_t len;
|
|
|
|
DbgPrint("Handle=0x%p Dlst=0x%p Dlcnt=%d Bytes=%d Offset=%lld "
|
|
- "SessionId=0x%llx\n", Handle, DList, DList_Cnt, Bytes,
|
|
- Offset, SessionId);
|
|
+ "SessionId=0x%llx\n", Handle, DList, DList_Cnt, Bytes, Offset, SessionId);
|
|
|
|
DList[0].page = NULL;
|
|
DList[0].offset = &lreply;
|
|
@@ -1334,10 +1212,7 @@ int novfs_write_pages(void *Handle, stru
|
|
cmd.len = len;
|
|
cmd.offset = Offset;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, cmdlen, DList, DList_Cnt,
|
|
- (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, cmdlen, DList, DList_Cnt, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (!retCode) {
|
|
if (reply) {
|
|
memcpy(&lreply, reply, sizeof(lreply));
|
|
@@ -1369,9 +1244,8 @@ int novfs_write_pages(void *Handle, stru
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_read_stream(void *ConnHandle, unsigned char * Handle, u_char * Buffer,
|
|
- size_t * Bytes, loff_t * Offset, int User,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_read_stream(void *ConnHandle, unsigned char *Handle, u_char * Buffer,
|
|
+ size_t * Bytes, loff_t * Offset, int User, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_read_stream_request cmd;
|
|
struct novfs_read_stream_reply *reply = NULL;
|
|
@@ -1382,10 +1256,9 @@ int novfs_read_stream(void *ConnHandle,
|
|
len = *Bytes;
|
|
*Bytes = 0;
|
|
|
|
- if (offsetof(struct novfs_read_file_reply, data) + len
|
|
- > novfs_max_iosize) {
|
|
+ if (offsetof(struct novfs_read_file_reply, data) + len > novfs_max_iosize) {
|
|
len = novfs_max_iosize - offsetof(struct
|
|
- novfs_read_file_reply, data);
|
|
+ novfs_read_file_reply, data);
|
|
len = (len / PAGE_SIZE) * PAGE_SIZE;
|
|
}
|
|
|
|
@@ -1398,9 +1271,7 @@ int novfs_read_stream(void *ConnHandle,
|
|
cmd.len = len;
|
|
cmd.offset = *Offset;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
DbgPrint("Queue_Daemon_Command 0x%x replylen=%d", retCode, replylen);
|
|
|
|
@@ -1410,12 +1281,10 @@ int novfs_read_stream(void *ConnHandle,
|
|
retCode = -EIO;
|
|
} else {
|
|
replylen -= offsetof(struct
|
|
- novfs_read_stream_reply, data);
|
|
+ novfs_read_stream_reply, data);
|
|
if (replylen > 0) {
|
|
if (User) {
|
|
- replylen -=
|
|
- copy_to_user(Buffer, reply->data,
|
|
- replylen);
|
|
+ replylen -= copy_to_user(Buffer, reply->data, replylen);
|
|
} else {
|
|
memcpy(Buffer, reply->data, replylen);
|
|
}
|
|
@@ -1431,11 +1300,11 @@ int novfs_read_stream(void *ConnHandle,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_write_stream(void *ConnHandle, unsigned char * Handle, u_char * Buffer,
|
|
+int novfs_write_stream(void *ConnHandle, unsigned char *Handle, u_char * Buffer,
|
|
size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId)
|
|
{
|
|
- struct novfs_write_stream_request * cmd;
|
|
- struct novfs_write_stream_reply * reply = NULL;
|
|
+ struct novfs_write_stream_request *cmd;
|
|
+ struct novfs_write_stream_reply *reply = NULL;
|
|
unsigned long replylen = 0;
|
|
int retCode = 0, cmdlen;
|
|
size_t len;
|
|
@@ -1449,7 +1318,7 @@ int novfs_write_stream(void *ConnHandle,
|
|
if (cmdlen > novfs_max_iosize) {
|
|
cmdlen = novfs_max_iosize;
|
|
len = cmdlen - offsetof(struct
|
|
- novfs_write_stream_request, data);
|
|
+ novfs_write_stream_request, data);
|
|
}
|
|
|
|
DbgPrint("cmdlen=%d len=%d", cmdlen, len);
|
|
@@ -1472,9 +1341,7 @@ int novfs_write_stream(void *ConnHandle,
|
|
cmd->len = len;
|
|
cmd->offset = *Offset;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
switch (reply->Reply.ErrorCode) {
|
|
case 0:
|
|
@@ -1493,8 +1360,7 @@ int novfs_write_stream(void *ConnHandle,
|
|
retCode = -EIO;
|
|
break;
|
|
}
|
|
- DbgPrint("reply->bytesWritten=0x%lx",
|
|
- reply->bytesWritten);
|
|
+ DbgPrint("reply->bytesWritten=0x%lx", reply->bytesWritten);
|
|
*Bytes = reply->bytesWritten;
|
|
kfree(reply);
|
|
}
|
|
@@ -1505,7 +1371,7 @@ int novfs_write_stream(void *ConnHandle,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_close_stream(void *ConnHandle, unsigned char * Handle, struct novfs_schandle SessionId)
|
|
+int novfs_close_stream(void *ConnHandle, unsigned char *Handle, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_close_stream_request cmd;
|
|
struct novfs_close_stream_reply *reply;
|
|
@@ -1519,9 +1385,7 @@ int novfs_close_stream(void *ConnHandle,
|
|
cmd.connection = ConnHandle;
|
|
memcpy(cmd.handle, Handle, sizeof(cmd.handle));
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, 0);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, 0);
|
|
if (reply) {
|
|
retCode = 0;
|
|
if (reply->Reply.ErrorCode) {
|
|
@@ -1532,7 +1396,7 @@ int novfs_close_stream(void *ConnHandle,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_delete(unsigned char * Path, int DirectoryFlag, struct novfs_schandle SessionId)
|
|
+int novfs_delete(unsigned char *Path, int DirectoryFlag, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_delete_file_request *cmd;
|
|
struct novfs_delete_file_reply *reply;
|
|
@@ -1557,9 +1421,7 @@ int novfs_delete(unsigned char * Path, i
|
|
cmd->pathlength = pathlen;
|
|
memcpy(cmd->path, Path, pathlen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = 0;
|
|
if (reply->Reply.ErrorCode) {
|
|
@@ -1571,7 +1433,7 @@ int novfs_delete(unsigned char * Path, i
|
|
retCode = -EACCES;
|
|
else if ((reply->Reply.ErrorCode & 0xFFFF) == 0x0513)
|
|
retCode = -ENOTEMPTY;
|
|
- else
|
|
+ else
|
|
retCode = -EIO;
|
|
}
|
|
kfree(reply);
|
|
@@ -1583,8 +1445,7 @@ int novfs_delete(unsigned char * Path, i
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_trunc(unsigned char * Path, int PathLen,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_trunc(unsigned char *Path, int PathLen, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_truncate_file_request *cmd;
|
|
struct novfs_truncate_file_reply *reply = NULL;
|
|
@@ -1596,7 +1457,7 @@ int novfs_trunc(unsigned char * Path, in
|
|
PathLen--;
|
|
}
|
|
cmdlen = offsetof(struct novfs_truncate_file_request, path)
|
|
- + PathLen;
|
|
+ + PathLen;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_TRUNCATE_FILE;
|
|
@@ -1606,9 +1467,7 @@ int novfs_trunc(unsigned char * Path, in
|
|
cmd->pathLen = PathLen;
|
|
memcpy(cmd->path, Path, PathLen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
if (reply->Reply.ErrorCode) {
|
|
retCode = -EIO;
|
|
@@ -1622,8 +1481,7 @@ int novfs_trunc(unsigned char * Path, in
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_trunc_ex(void *Handle, loff_t Offset,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_trunc_ex(void *Handle, loff_t Offset, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_write_file_request cmd;
|
|
struct novfs_write_file_reply *reply = NULL;
|
|
@@ -1641,9 +1499,7 @@ int novfs_trunc_ex(void *Handle, loff_t
|
|
cmd.len = 0;
|
|
cmd.offset = Offset;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
DbgPrint("retCode=0x%x reply=0x%p", retCode, reply);
|
|
|
|
@@ -1680,9 +1536,8 @@ int novfs_trunc_ex(void *Handle, loff_t
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_rename_file(int DirectoryFlag, unsigned char * OldName, int OldLen,
|
|
- unsigned char * NewName, int NewLen,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_rename_file(int DirectoryFlag, unsigned char *OldName, int OldLen,
|
|
+ unsigned char *NewName, int NewLen, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_rename_file_request cmd;
|
|
struct novfs_rename_file_reply *reply;
|
|
@@ -1690,11 +1545,10 @@ int novfs_rename_file(int DirectoryFlag,
|
|
int retCode;
|
|
|
|
__DbgPrint("%s:\n"
|
|
- " DirectoryFlag: %d\n"
|
|
- " OldName: %.*s\n"
|
|
- " NewName: %.*s\n"
|
|
- " SessionId: 0x%llx\n", __func__,
|
|
- DirectoryFlag, OldLen, OldName, NewLen, NewName, SessionId);
|
|
+ " DirectoryFlag: %d\n"
|
|
+ " OldName: %.*s\n"
|
|
+ " NewName: %.*s\n"
|
|
+ " SessionId: 0x%llx\n", __func__, DirectoryFlag, OldLen, OldName, NewLen, NewName, SessionId);
|
|
|
|
cmd.Command.CommandType = VFS_COMMAND_RENAME_FILE;
|
|
cmd.Command.SequenceNumber = 0;
|
|
@@ -1715,9 +1569,7 @@ int novfs_rename_file(int DirectoryFlag,
|
|
cmd.oldnameLen = OldLen;
|
|
memcpy(cmd.oldname, OldName, OldLen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(&cmd, sizeof(cmd), NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = 0;
|
|
if (reply->Reply.ErrorCode) {
|
|
@@ -1728,8 +1580,7 @@ int novfs_rename_file(int DirectoryFlag,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_set_attr(unsigned char * Path, struct iattr *Attr,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_set_attr(unsigned char *Path, struct iattr *Attr, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_set_file_info_request *cmd;
|
|
struct novfs_set_file_info_reply *reply;
|
|
@@ -1743,7 +1594,7 @@ int novfs_set_attr(unsigned char * Path,
|
|
pathlen--;
|
|
}
|
|
|
|
- cmdlen = offsetof(struct novfs_set_file_info_request,path) + pathlen;
|
|
+ cmdlen = offsetof(struct novfs_set_file_info_request, path) + pathlen;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_SET_FILE_INFO;
|
|
@@ -1765,9 +1616,7 @@ int novfs_set_attr(unsigned char * Path,
|
|
cmd->pathlength = pathlen;
|
|
memcpy(cmd->path, Path, pathlen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
switch (reply->Reply.ErrorCode) {
|
|
case 0:
|
|
@@ -1795,8 +1644,7 @@ int novfs_set_attr(unsigned char * Path,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_get_file_cache_flag(unsigned char * Path,
|
|
- struct novfs_schandle SessionId)
|
|
+int novfs_get_file_cache_flag(unsigned char *Path, struct novfs_schandle SessionId)
|
|
{
|
|
struct novfs_get_cache_flag *cmd;
|
|
struct novfs_get_cache_flag_reply *reply = NULL;
|
|
@@ -1813,10 +1661,9 @@ int novfs_get_file_cache_flag(unsigned c
|
|
if ('.' == Path[pathlen - 1])
|
|
pathlen--;
|
|
}
|
|
- cmdlen = offsetof(struct novfs_get_cache_flag, path) +
|
|
- pathlen;
|
|
+ cmdlen = offsetof(struct novfs_get_cache_flag, path) + pathlen;
|
|
cmd = (struct novfs_get_cache_flag *)
|
|
- kmalloc(cmdlen, GFP_KERNEL);
|
|
+ kmalloc(cmdlen, GFP_KERNEL);
|
|
if (cmd) {
|
|
cmd->Command.CommandType = VFS_COMMAND_GET_CACHE_FLAG;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -1824,9 +1671,7 @@ int novfs_get_file_cache_flag(unsigned c
|
|
cmd->pathLen = pathlen;
|
|
memcpy(cmd->path, Path, cmd->pathLen);
|
|
|
|
- Queue_Daemon_Command(cmd, cmdlen, NULL, 0,
|
|
- (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ Queue_Daemon_Command(cmd, cmdlen, NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
|
|
@@ -1851,8 +1696,7 @@ int novfs_get_file_cache_flag(unsigned c
|
|
*
|
|
* Notes: lock type - fcntl
|
|
*/
|
|
-int novfs_set_file_lock(struct novfs_schandle SessionId, void *Handle,
|
|
- unsigned char fl_type, loff_t fl_start, loff_t fl_len)
|
|
+int novfs_set_file_lock(struct novfs_schandle SessionId, void *Handle, unsigned char fl_type, loff_t fl_start, loff_t fl_len)
|
|
{
|
|
struct novfs_set_file_lock_request *cmd;
|
|
struct novfs_set_file_lock_reply *reply = NULL;
|
|
@@ -1863,8 +1707,7 @@ int novfs_set_file_lock(struct novfs_sch
|
|
|
|
DbgPrint("SessionId: 0x%llx\n", SessionId);
|
|
|
|
- cmd =
|
|
- (struct novfs_set_file_lock_request *) kmalloc(sizeof(struct novfs_set_file_lock_request), GFP_KERNEL);
|
|
+ cmd = (struct novfs_set_file_lock_request *)kmalloc(sizeof(struct novfs_set_file_lock_request), GFP_KERNEL);
|
|
|
|
if (cmd) {
|
|
DbgPrint("2");
|
|
@@ -1887,20 +1730,17 @@ int novfs_set_file_lock(struct novfs_sch
|
|
DbgPrint("3");
|
|
|
|
DbgPrint("BEGIN dump arguments");
|
|
- DbgPrint("Queue_Daemon_Command %d",
|
|
- cmd->Command.CommandType);
|
|
+ DbgPrint("Queue_Daemon_Command %d", cmd->Command.CommandType);
|
|
DbgPrint("cmd->handle = 0x%p", cmd->handle);
|
|
DbgPrint("cmd->fl_type = %u", cmd->fl_type);
|
|
DbgPrint("cmd->fl_start = 0x%X", cmd->fl_start);
|
|
DbgPrint("cmd->fl_len = 0x%X", cmd->fl_len);
|
|
- DbgPrint("sizeof(SET_FILE_LOCK_REQUEST) = %u",
|
|
- sizeof(struct novfs_set_file_lock_request));
|
|
+ DbgPrint("sizeof(SET_FILE_LOCK_REQUEST) = %u", sizeof(struct novfs_set_file_lock_request));
|
|
DbgPrint("END dump arguments");
|
|
|
|
retCode =
|
|
Queue_Daemon_Command(cmd, sizeof(struct novfs_set_file_lock_request),
|
|
- NULL, 0, (void *)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ NULL, 0, (void *)&reply, &replylen, INTERRUPTIBLE);
|
|
DbgPrint("4");
|
|
|
|
if (reply) {
|
|
--- a/fs/novfs/inode.c
|
|
+++ b/fs/novfs/inode.c
|
|
@@ -36,7 +36,6 @@
|
|
/*===[ Include files specific to this module ]============================*/
|
|
#include "vfs.h"
|
|
|
|
-
|
|
struct inode_data {
|
|
void *Scope;
|
|
unsigned long Flags;
|
|
@@ -45,7 +44,7 @@ struct inode_data {
|
|
unsigned long cntDC;
|
|
struct list_head DirCache;
|
|
struct semaphore DirCacheLock;
|
|
- void * FileHandle;
|
|
+ void *FileHandle;
|
|
int CacheFlag;
|
|
char Name[1]; /* Needs to be last entry */
|
|
};
|
|
@@ -57,12 +56,10 @@ struct inode_data {
|
|
static unsigned long novfs_internal_hash(struct qstr *name);
|
|
static int novfs_d_add(struct dentry *p, struct dentry *d, struct inode *i, int add);
|
|
|
|
-static int novfs_get_sb(struct file_system_type *Fstype, int Flags,
|
|
- const char *Dev_name, void *Data, struct vfsmount *Mnt);
|
|
+static int novfs_get_sb(struct file_system_type *Fstype, int Flags, const char *Dev_name, void *Data, struct vfsmount *Mnt);
|
|
|
|
static void novfs_kill_sb(struct super_block *SB);
|
|
|
|
-
|
|
/*
|
|
* Declared dentry_operations
|
|
*/
|
|
@@ -81,8 +78,7 @@ int novfs_dir_release(struct inode *inod
|
|
loff_t novfs_dir_lseek(struct file *file, loff_t offset, int origin);
|
|
ssize_t novfs_dir_read(struct file *file, char *buf, size_t len, loff_t * off);
|
|
void addtodentry(struct dentry *Parent, unsigned char *List, int Level);
|
|
-int novfs_filldir(void *data, const char *name, int namelen, loff_t off,
|
|
- ino_t ino, unsigned ftype);
|
|
+int novfs_filldir(void *data, const char *name, int namelen, loff_t off, ino_t ino, unsigned ftype);
|
|
int novfs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir);
|
|
int novfs_dir_fsync(struct file *file, int datasync);
|
|
|
|
@@ -90,19 +86,14 @@ int novfs_dir_fsync(struct file *file, i
|
|
* Declared address space operations
|
|
*/
|
|
int novfs_a_writepage(struct page *page, struct writeback_control *wbc);
|
|
-int novfs_a_writepages(struct address_space *mapping,
|
|
- struct writeback_control *wbc);
|
|
+int novfs_a_writepages(struct address_space *mapping, struct writeback_control *wbc);
|
|
int novfs_a_write_begin(struct file *file, struct address_space *mapping,
|
|
- loff_t pos, unsigned len, unsigned flags,
|
|
- struct page **pagep, void **fsdata);
|
|
+ loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata);
|
|
int novfs_a_write_end(struct file *file, struct address_space *mapping,
|
|
- loff_t pos, unsigned len, unsigned copied,
|
|
- struct page *pagep, void *fsdata);
|
|
+ loff_t pos, unsigned len, unsigned copied, struct page *pagep, void *fsdata);
|
|
int novfs_a_readpage(struct file *file, struct page *page);
|
|
-int novfs_a_readpages(struct file *file, struct address_space *mapping,
|
|
- struct list_head *page_lst, unsigned nr_pages);
|
|
-ssize_t novfs_a_direct_IO(int rw, struct kiocb *kiocb, const struct iovec *iov,
|
|
- loff_t offset, unsigned long nr_segs);
|
|
+int novfs_a_readpages(struct file *file, struct address_space *mapping, struct list_head *page_lst, unsigned nr_pages);
|
|
+ssize_t novfs_a_direct_IO(int rw, struct kiocb *kiocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs);
|
|
|
|
/*
|
|
* Declared file_operations
|
|
@@ -122,14 +113,12 @@ int novfs_f_lock(struct file *, int, str
|
|
* Declared inode_operations
|
|
*/
|
|
int novfs_i_create(struct inode *, struct dentry *, int, struct nameidata *);
|
|
-struct dentry *novfs_i_lookup(struct inode *, struct dentry *,
|
|
- struct nameidata *);
|
|
+struct dentry *novfs_i_lookup(struct inode *, struct dentry *, struct nameidata *);
|
|
int novfs_i_mkdir(struct inode *, struct dentry *, int);
|
|
int novfs_i_unlink(struct inode *dir, struct dentry *dentry);
|
|
int novfs_i_rmdir(struct inode *, struct dentry *);
|
|
int novfs_i_mknod(struct inode *, struct dentry *, int, dev_t);
|
|
-int novfs_i_rename(struct inode *, struct dentry *, struct inode *,
|
|
- struct dentry *);
|
|
+int novfs_i_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
|
|
int novfs_i_setattr(struct dentry *, struct iattr *);
|
|
int novfs_i_getattr(struct vfsmount *mnt, struct dentry *, struct kstat *);
|
|
int novfs_i_revalidate(struct dentry *dentry);
|
|
@@ -138,10 +127,8 @@ int novfs_i_revalidate(struct dentry *de
|
|
* Extended attributes operations
|
|
*/
|
|
|
|
-ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
|
|
- size_t size);
|
|
-int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value,
|
|
- size_t value_size, int flags);
|
|
+ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
|
|
+int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value, size_t value_size, int flags);
|
|
ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
|
|
|
|
void update_inode(struct inode *Inode, struct novfs_entry_info *Info);
|
|
@@ -160,38 +147,27 @@ int novfs_statfs(struct dentry *de, stru
|
|
/*
|
|
* Declared control interface functions
|
|
*/
|
|
-ssize_t
|
|
-novfs_control_Read(struct file *file, char *buf, size_t nbytes, loff_t * ppos);
|
|
+ssize_t novfs_control_Read(struct file *file, char *buf, size_t nbytes, loff_t * ppos);
|
|
|
|
-ssize_t
|
|
-novfs_control_write(struct file *file, const char *buf, size_t nbytes,
|
|
- loff_t * ppos);
|
|
+ssize_t novfs_control_write(struct file *file, const char *buf, size_t nbytes, loff_t * ppos);
|
|
|
|
-int novfs_control_ioctl(struct inode *inode, struct file *file,
|
|
- unsigned int cmd, unsigned long arg);
|
|
+int novfs_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
|
|
|
|
int __init init_novfs(void);
|
|
void __exit exit_novfs(void);
|
|
|
|
int novfs_lock_inode_cache(struct inode *i);
|
|
void novfs_unlock_inode_cache(struct inode *i);
|
|
-int novfs_enumerate_inode_cache(struct inode *i, struct list_head **iteration,
|
|
- ino_t * ino, struct novfs_entry_info *info);
|
|
-int novfs_get_entry(struct inode *i, struct qstr *name, ino_t * ino,
|
|
- struct novfs_entry_info *info);
|
|
-int novfs_get_entry_by_pos(struct inode *i, loff_t pos, ino_t * ino,
|
|
- struct novfs_entry_info *info);
|
|
-int novfs_get_entry_time(struct inode *i, struct qstr *name, ino_t * ino,
|
|
- struct novfs_entry_info *info, u64 * EntryTime);
|
|
+int novfs_enumerate_inode_cache(struct inode *i, struct list_head **iteration, ino_t * ino, struct novfs_entry_info *info);
|
|
+int novfs_get_entry(struct inode *i, struct qstr *name, ino_t * ino, struct novfs_entry_info *info);
|
|
+int novfs_get_entry_by_pos(struct inode *i, loff_t pos, ino_t * ino, struct novfs_entry_info *info);
|
|
+int novfs_get_entry_time(struct inode *i, struct qstr *name, ino_t * ino, struct novfs_entry_info *info, u64 * EntryTime);
|
|
int novfs_get_remove_entry(struct inode *i, ino_t * ino, struct novfs_entry_info *info);
|
|
void novfs_invalidate_inode_cache(struct inode *i);
|
|
-struct novfs_dir_cache *novfs_lookup_inode_cache(struct inode *i, struct qstr *name,
|
|
- ino_t ino);
|
|
+struct novfs_dir_cache *novfs_lookup_inode_cache(struct inode *i, struct qstr *name, ino_t ino);
|
|
int novfs_lookup_validate(struct inode *i, struct qstr *name, ino_t ino);
|
|
-int novfs_add_inode_entry(struct inode *i, struct qstr *name, ino_t ino,
|
|
- struct novfs_entry_info *info);
|
|
-int novfs_update_entry(struct inode *i, struct qstr *name, ino_t ino,
|
|
- struct novfs_entry_info *info);
|
|
+int novfs_add_inode_entry(struct inode *i, struct qstr *name, ino_t ino, struct novfs_entry_info *info);
|
|
+int novfs_update_entry(struct inode *i, struct qstr *name, ino_t ino, struct novfs_entry_info *info);
|
|
void novfs_remove_inode_entry(struct inode *i, struct qstr *name, ino_t ino);
|
|
void novfs_free_invalid_entries(struct inode *i);
|
|
void novfs_free_inode_cache(struct inode *i);
|
|
@@ -294,7 +270,6 @@ static struct file_operations novfs_Cont
|
|
|
|
static atomic_t novfs_Inode_Number = ATOMIC_INIT(0);
|
|
|
|
-
|
|
struct dentry *novfs_root = NULL;
|
|
char *novfs_current_mnt = NULL;
|
|
|
|
@@ -325,18 +300,13 @@ static void PRINT_DENTRY(const char *s,
|
|
__DbgPrint(" d_lock: 0x%x\n", d->d_lock);
|
|
__DbgPrint(" d_inode: 0x%x\n", d->d_inode);
|
|
__DbgPrint(" d_lru: 0x%p\n"
|
|
- " next: 0x%p\n"
|
|
- " prev: 0x%p\n", &d->d_lru, d->d_lru.next,
|
|
- d->d_lru.prev);
|
|
+ " next: 0x%p\n" " prev: 0x%p\n", &d->d_lru, d->d_lru.next, d->d_lru.prev);
|
|
__DbgPrint(" d_child: 0x%p\n" " next: 0x%p\n"
|
|
- " prev: 0x%p\n", &d->d_u.d_child,
|
|
- d->d_u.d_child.next, d->d_u.d_child.prev);
|
|
+ " prev: 0x%p\n", &d->d_u.d_child, d->d_u.d_child.next, d->d_u.d_child.prev);
|
|
__DbgPrint(" d_subdirs: 0x%p\n" " next: 0x%p\n"
|
|
- " prev: 0x%p\n", &d->d_subdirs, d->d_subdirs.next,
|
|
- d->d_subdirs.prev);
|
|
+ " prev: 0x%p\n", &d->d_subdirs, d->d_subdirs.next, d->d_subdirs.prev);
|
|
__DbgPrint(" d_alias: 0x%p\n" " next: 0x%p\n"
|
|
- " prev: 0x%p\n", &d->d_alias, d->d_alias.next,
|
|
- d->d_alias.prev);
|
|
+ " prev: 0x%p\n", &d->d_alias, d->d_alias.next, d->d_alias.prev);
|
|
__DbgPrint(" d_time: 0x%x\n", d->d_time);
|
|
__DbgPrint(" d_op: 0x%p\n", d->d_op);
|
|
__DbgPrint(" d_sb: 0x%p\n", d->d_sb);
|
|
@@ -345,14 +315,11 @@ static void PRINT_DENTRY(const char *s,
|
|
__DbgPrint(" d_fsdata: 0x%p\n", d->d_fsdata);
|
|
/* DbgPrint(" d_cookie: 0x%x\n", d->d_cookie); */
|
|
__DbgPrint(" d_parent: 0x%p\n", d->d_parent);
|
|
- __DbgPrint(" d_name: 0x%p %.*s\n", &d->d_name, d->d_name.len,
|
|
- d->d_name.name);
|
|
+ __DbgPrint(" d_name: 0x%p %.*s\n", &d->d_name, d->d_name.len, d->d_name.name);
|
|
__DbgPrint(" name: 0x%p\n" " len: %d\n"
|
|
- " hash: 0x%x\n", d->d_name.name, d->d_name.len,
|
|
- d->d_name.hash);
|
|
+ " hash: 0x%x\n", d->d_name.name, d->d_name.len, d->d_name.hash);
|
|
__DbgPrint(" d_hash: 0x%x\n" " next: 0x%x\n"
|
|
- " pprev: 0x%x\n", d->d_hash, d->d_hash.next,
|
|
- d->d_hash.pprev);
|
|
+ " pprev: 0x%x\n", d->d_hash, d->d_hash.next, d->d_hash.pprev);
|
|
}
|
|
|
|
/*++======================================================================*/
|
|
@@ -370,8 +337,7 @@ int novfs_remove_from_root(char *RemoveN
|
|
dentry = d_lookup(novfs_root, &name);
|
|
if (dentry) {
|
|
if (dentry->d_inode && dentry->d_inode->i_private) {
|
|
- struct inode_data *n_inode =
|
|
- dentry->d_inode->i_private;
|
|
+ struct inode_data *n_inode = dentry->d_inode->i_private;
|
|
n_inode->Scope = NULL;
|
|
}
|
|
dput(dentry);
|
|
@@ -410,7 +376,7 @@ int novfs_add_to_root(char *AddName)
|
|
info.size = 0;
|
|
info.atime = info.ctime = info.mtime = CURRENT_TIME;
|
|
|
|
- ino = (ino_t)atomic_inc_return(&novfs_Inode_Number);
|
|
+ ino = (ino_t) atomic_inc_return(&novfs_Inode_Number);
|
|
novfs_add_inode_entry(dir, &name, ino, &info);
|
|
}
|
|
|
|
@@ -446,20 +412,16 @@ int novfs_Add_to_Root2(char *AddName)
|
|
/*
|
|
* done in novfs_d_add now... entry->d_fsdata = (void *)novfs_internal_hash( &name );
|
|
*/
|
|
- inode =
|
|
- novfs_get_inode(novfs_root->d_sb, S_IFDIR | 0700, 0, novfs_scope_get_uid(scope), 0, &name);
|
|
+ inode = novfs_get_inode(novfs_root->d_sb, S_IFDIR | 0700, 0, novfs_scope_get_uid(scope), 0, &name);
|
|
DbgPrint("Inode=0x%p", inode);
|
|
if (inode) {
|
|
- inode->i_atime =
|
|
- inode->i_ctime =
|
|
- inode->i_mtime = CURRENT_TIME;
|
|
+ inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
|
if (!novfs_d_add(novfs_root, entry, inode, 1)) {
|
|
if (inode->i_private) {
|
|
struct inode_data *n_inode = inode->i_private;
|
|
n_inode->Flags = USER_INODE;
|
|
}
|
|
- PRINT_DENTRY("After novfs_d_add",
|
|
- entry);
|
|
+ PRINT_DENTRY("After novfs_d_add", entry);
|
|
} else {
|
|
dput(entry);
|
|
iput(inode);
|
|
@@ -524,8 +486,7 @@ int verify_dentry(struct dentry *dentry,
|
|
return (0);
|
|
}
|
|
|
|
- if (dentry && dentry->d_parent &&
|
|
- (dir = dentry->d_parent->d_inode) && (id = dir->i_private)) {
|
|
+ if (dentry && dentry->d_parent && (dir = dentry->d_parent->d_inode) && (id = dir->i_private)) {
|
|
parent = dget_parent(dentry);
|
|
|
|
info = kmalloc(sizeof(struct novfs_entry_info) + PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
@@ -538,11 +499,8 @@ int verify_dentry(struct dentry *dentry,
|
|
if (!novfs_get_entry_time(dir, &name, &ino, info, &ctime)) {
|
|
inode = dentry->d_inode;
|
|
if (inode && inode->i_private &&
|
|
- ((inode->i_size != info->size) ||
|
|
- (inode->i_mtime.tv_sec !=
|
|
- info->mtime.tv_sec)
|
|
- || (inode->i_mtime.tv_nsec !=
|
|
- info->mtime.tv_nsec))) {
|
|
+ ((inode->i_size != info->size) || (inode->i_mtime.tv_sec != info->mtime.tv_sec)
|
|
+ || (inode->i_mtime.tv_nsec != info->mtime.tv_nsec))) {
|
|
/*
|
|
* Values don't match so update.
|
|
*/
|
|
@@ -563,8 +521,7 @@ int verify_dentry(struct dentry *dentry,
|
|
}
|
|
|
|
if (IS_ROOT(dentry->d_parent)) {
|
|
- session = novfs_scope_get_sessionId(
|
|
- novfs_get_scope_from_name(&dentry->d_name));
|
|
+ session = novfs_scope_get_sessionId(novfs_get_scope_from_name(&dentry->d_name));
|
|
} else
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
|
|
@@ -595,7 +552,7 @@ int verify_dentry(struct dentry *dentry,
|
|
info->mode = S_IFDIR | 0700;
|
|
info->size = 0;
|
|
info->atime = info->ctime = info->mtime = CURRENT_TIME;
|
|
- ino = (ino_t)atomic_inc_return(&novfs_Inode_Number);
|
|
+ ino = (ino_t) atomic_inc_return(&novfs_Inode_Number);
|
|
novfs_add_inode_entry(dir, &name, ino, info);
|
|
}
|
|
}
|
|
@@ -603,75 +560,48 @@ int verify_dentry(struct dentry *dentry,
|
|
novfs_free_invalid_entries(dir);
|
|
} else {
|
|
|
|
- path =
|
|
- novfs_dget_path(dentry, info->name,
|
|
- PATH_LENGTH_BUFFER);
|
|
+ path = novfs_dget_path(dentry, info->name, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- if (dentry->d_name.len <=
|
|
- NW_MAX_PATH_LENGTH) {
|
|
- name.hash =
|
|
- novfs_internal_hash
|
|
- (&dentry->d_name);
|
|
+ if (dentry->d_name.len <= NW_MAX_PATH_LENGTH) {
|
|
+ name.hash = novfs_internal_hash(&dentry->d_name);
|
|
name.len = dentry->d_name.len;
|
|
name.name = dentry->d_name.name;
|
|
|
|
- retVal =
|
|
- novfs_get_file_info(path,
|
|
- info,
|
|
- session);
|
|
+ retVal = novfs_get_file_info(path, info, session);
|
|
if (0 == retVal) {
|
|
- dentry->d_time =
|
|
- jiffies +
|
|
- (novfs_update_timeout
|
|
- * HZ);
|
|
- iLock =
|
|
- novfs_lock_inode_cache
|
|
- (dir);
|
|
- if (novfs_update_entry
|
|
- (dir, &name, 0,
|
|
- info)) {
|
|
- if (dentry->
|
|
- d_inode) {
|
|
+ dentry->d_time = jiffies + (novfs_update_timeout * HZ);
|
|
+ iLock = novfs_lock_inode_cache(dir);
|
|
+ if (novfs_update_entry(dir, &name, 0, info)) {
|
|
+ if (dentry->d_inode) {
|
|
ino = dentry->d_inode->i_ino;
|
|
} else {
|
|
- ino = (ino_t)atomic_inc_return(&novfs_Inode_Number);
|
|
+ ino = (ino_t) atomic_inc_return(&novfs_Inode_Number);
|
|
}
|
|
- novfs_add_inode_entry
|
|
- (dir, &name,
|
|
- ino, info);
|
|
+ novfs_add_inode_entry(dir, &name, ino, info);
|
|
}
|
|
if (dentry->d_inode) {
|
|
- update_inode
|
|
- (dentry->
|
|
- d_inode,
|
|
- info);
|
|
- id->Flags &=
|
|
- ~UPDATE_INODE;
|
|
-
|
|
- dentry->
|
|
- d_inode->
|
|
- i_flags &=
|
|
- ~S_DEAD;
|
|
- if (dentry->
|
|
- d_inode->
|
|
- i_private) {
|
|
- ((struct inode_data *) dentry->d_inode->i_private)->Scope = id->Scope;
|
|
+ update_inode(dentry->d_inode, info);
|
|
+ id->Flags &= ~UPDATE_INODE;
|
|
+
|
|
+ dentry->d_inode->i_flags &= ~S_DEAD;
|
|
+ if (dentry->d_inode->i_private) {
|
|
+ ((struct inode_data *)dentry->d_inode->i_private)->Scope =
|
|
+ id->Scope;
|
|
}
|
|
}
|
|
} else if (-EINTR != retVal) {
|
|
retVal = 0;
|
|
iLock = novfs_lock_inode_cache(dir);
|
|
novfs_remove_inode_entry(dir, &name, 0);
|
|
- if (dentry->d_inode
|
|
- && !(dentry->d_inode->i_flags & S_DEAD)) {
|
|
+ if (dentry->d_inode && !(dentry->d_inode->i_flags & S_DEAD)) {
|
|
dentry->d_inode->i_flags |= S_DEAD;
|
|
- dentry->d_inode-> i_size = 0;
|
|
+ dentry->d_inode->i_size = 0;
|
|
dentry->d_inode->i_atime.tv_sec =
|
|
- dentry->d_inode->i_atime.tv_nsec =
|
|
- dentry->d_inode->i_ctime.tv_sec =
|
|
- dentry->d_inode->i_ctime.tv_nsec =
|
|
- dentry->d_inode->i_mtime.tv_sec =
|
|
- dentry->d_inode->i_mtime.tv_nsec = 0;
|
|
+ dentry->d_inode->i_atime.tv_nsec =
|
|
+ dentry->d_inode->i_ctime.tv_sec =
|
|
+ dentry->d_inode->i_ctime.tv_nsec =
|
|
+ dentry->d_inode->i_mtime.tv_sec =
|
|
+ dentry->d_inode->i_mtime.tv_nsec = 0;
|
|
dentry->d_inode->i_blocks = 0;
|
|
d_delete(dentry); /* Remove from cache */
|
|
}
|
|
@@ -700,7 +630,6 @@ int verify_dentry(struct dentry *dentry,
|
|
return (retVal);
|
|
}
|
|
|
|
-
|
|
static int novfs_d_add(struct dentry *Parent, struct dentry *d, struct inode *i, int a)
|
|
{
|
|
void *scope;
|
|
@@ -712,14 +641,13 @@ static int novfs_d_add(struct dentry *Pa
|
|
if (buf) {
|
|
path = novfs_dget_path(d, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- DbgPrint("inode=0x%p ino=%d path %s", i,
|
|
- i->i_ino, path);
|
|
+ DbgPrint("inode=0x%p ino=%d path %s", i, i->i_ino, path);
|
|
}
|
|
kfree(buf);
|
|
}
|
|
|
|
if (Parent && Parent->d_inode && Parent->d_inode->i_private) {
|
|
- id = (struct inode_data *) Parent->d_inode->i_private;
|
|
+ id = (struct inode_data *)Parent->d_inode->i_private;
|
|
}
|
|
|
|
if (id && id->Scope) {
|
|
@@ -728,7 +656,7 @@ static int novfs_d_add(struct dentry *Pa
|
|
scope = novfs_get_scope(d);
|
|
}
|
|
|
|
- ((struct inode_data *) i->i_private)->Scope = scope;
|
|
+ ((struct inode_data *)i->i_private)->Scope = scope;
|
|
|
|
d->d_time = jiffies + (novfs_update_timeout * HZ);
|
|
if (a) {
|
|
@@ -750,16 +678,12 @@ int novfs_d_revalidate(struct dentry *de
|
|
__DbgPrint("%s: 0x%p %.*s\n"
|
|
" d_count: %d\n"
|
|
" d_inode: 0x%p\n", __func__,
|
|
- dentry, dentry->d_name.len, dentry->d_name.name,
|
|
- dentry->d_count, dentry->d_inode);
|
|
+ dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_count, dentry->d_inode);
|
|
|
|
if (IS_ROOT(dentry)) {
|
|
retCode = 1;
|
|
} else {
|
|
- if (dentry->d_inode &&
|
|
- dentry->d_parent &&
|
|
- (dir = dentry->d_parent->d_inode) &&
|
|
- (id = dir->i_private)) {
|
|
+ if (dentry->d_inode && dentry->d_parent && (dir = dentry->d_parent->d_inode) && (id = dir->i_private)) {
|
|
/*
|
|
* Check timer to see if in valid time limit
|
|
*/
|
|
@@ -769,18 +693,13 @@ int novfs_d_revalidate(struct dentry *de
|
|
*/
|
|
name.len = dentry->d_name.len;
|
|
name.name = dentry->d_name.name;
|
|
- name.hash =
|
|
- novfs_internal_hash(&dentry->d_name);
|
|
+ name.hash = novfs_internal_hash(&dentry->d_name);
|
|
dentry->d_time = 0;
|
|
|
|
if (0 == verify_dentry(dentry, 0)) {
|
|
if (novfs_lock_inode_cache(dir)) {
|
|
- if (novfs_lookup_inode_cache
|
|
- (dir, &name, 0)) {
|
|
- dentry->d_time =
|
|
- jiffies +
|
|
- (novfs_update_timeout
|
|
- * HZ);
|
|
+ if (novfs_lookup_inode_cache(dir, &name, 0)) {
|
|
+ dentry->d_time = jiffies + (novfs_update_timeout * HZ);
|
|
retCode = 1;
|
|
}
|
|
novfs_unlock_inode_cache(dir);
|
|
@@ -800,8 +719,7 @@ int novfs_d_revalidate(struct dentry *de
|
|
*/
|
|
}
|
|
|
|
- DbgPrint("return 0x%x %.*s", retCode,
|
|
- dentry->d_name.len, dentry->d_name.name);
|
|
+ DbgPrint("return 0x%x %.*s", retCode, dentry->d_name.len, dentry->d_name.name);
|
|
|
|
return (retCode);
|
|
}
|
|
@@ -837,8 +755,7 @@ int novfs_d_strcmp(struct qstr *s1, stru
|
|
unsigned char *str1, *str2;
|
|
unsigned int len;
|
|
|
|
- DbgPrint("s1=%.*s s2=%.*s", s1->len, s1->name,
|
|
- s2->len, s2->name);
|
|
+ DbgPrint("s1=%.*s s2=%.*s", s1->len, s1->name, s2->len, s2->name);
|
|
|
|
if (s1->len && (s1->len == s2->len) && (s1->hash == s2->hash)) {
|
|
len = s1->len;
|
|
@@ -873,8 +790,7 @@ int novfs_d_delete(struct dentry *dentry
|
|
int retVal = 0;
|
|
|
|
DbgPrint("0x%p %.*s; d_count: %d; d_inode: 0x%p",
|
|
- dentry, dentry->d_name.len, dentry->d_name.name,
|
|
- dentry->d_count, dentry->d_inode);
|
|
+ dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_count, dentry->d_inode);
|
|
|
|
if (dentry->d_inode && (dentry->d_inode->i_flags & S_DEAD)) {
|
|
retVal = 1;
|
|
@@ -887,15 +803,13 @@ int novfs_d_delete(struct dentry *dentry
|
|
|
|
void novfs_d_release(struct dentry *dentry)
|
|
{
|
|
- DbgPrint("0x%p %.*s", dentry, dentry->d_name.len,
|
|
- dentry->d_name.name);
|
|
+ DbgPrint("0x%p %.*s", dentry, dentry->d_name.len, dentry->d_name.name);
|
|
}
|
|
|
|
void novfs_d_iput(struct dentry *dentry, struct inode *inode)
|
|
{
|
|
DbgPrint("Inode=0x%p Ino=%d Dentry=0x%p i_state=%d Name=%.*s",
|
|
- inode, inode->i_ino, dentry, inode->i_state, dentry->d_name.len,
|
|
- dentry->d_name.name);
|
|
+ inode, inode->i_ino, dentry, inode->i_state, dentry->d_name.len, dentry->d_name.name);
|
|
|
|
iput(inode);
|
|
|
|
@@ -906,8 +820,7 @@ int novfs_dir_open(struct inode *dir, st
|
|
char *path, *buf;
|
|
struct file_private *file_private = NULL;
|
|
|
|
- DbgPrint("Inode 0x%p %d Name %.*s", dir, dir->i_ino,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
+ DbgPrint("Inode 0x%p %d Name %.*s", dir, dir->i_ino, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
buf = kmalloc(PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (buf) {
|
|
@@ -933,8 +846,7 @@ int novfs_dir_release(struct inode *dir,
|
|
struct inode *inode = file->f_dentry->d_inode;
|
|
struct novfs_schandle sessionId;
|
|
|
|
- DbgPrint("Inode 0x%p %d Name %.*s", dir, dir->i_ino,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
+ DbgPrint("Inode 0x%p %d Name %.*s", dir, dir->i_ino, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
if (file_private) {
|
|
if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) {
|
|
@@ -956,8 +868,7 @@ loff_t novfs_dir_lseek(struct file * fil
|
|
{
|
|
struct file_private *file_private = NULL;
|
|
|
|
- DbgPrint("offset %lld %d Name %.*s", offset, origin,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
+ DbgPrint("offset %lld %d Name %.*s", offset, origin, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
//printk("<1> seekdir file = %.*s offset = %i\n", file->f_dentry->d_name.len, file->f_dentry->d_name.name, (int)offset);
|
|
|
|
if (0 != offset) {
|
|
@@ -966,7 +877,7 @@ loff_t novfs_dir_lseek(struct file * fil
|
|
|
|
file->f_pos = 0;
|
|
|
|
- file_private = (struct file_private *) file->private_data;
|
|
+ file_private = (struct file_private *)file->private_data;
|
|
file_private->listedall = 0;
|
|
if (file_private->enumHandle && (file_private->enumHandle != ((void *)-1))) {
|
|
struct novfs_schandle sessionId;
|
|
@@ -999,8 +910,7 @@ ssize_t novfs_dir_read(struct file * fil
|
|
}
|
|
return(rlen);
|
|
*/
|
|
- DbgPrint("%lld %d Name %.*s", *off, len,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
+ DbgPrint("%lld %d Name %.*s", *off, len, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
return (generic_read_dir(file, buf, len, off));
|
|
}
|
|
|
|
@@ -1039,8 +949,7 @@ static void novfs_Dump_Info(struct novfs
|
|
DbgPrint("name = %s", namebuf);
|
|
}
|
|
|
|
-void processList(struct file *file, void *dirent, filldir_t filldir, char *list,
|
|
- int type, struct novfs_schandle SessionId)
|
|
+void processList(struct file *file, void *dirent, filldir_t filldir, char *list, int type, struct novfs_schandle SessionId)
|
|
{
|
|
unsigned char *path, *buf = NULL, *cp;
|
|
struct qstr name;
|
|
@@ -1066,20 +975,16 @@ void processList(struct file *file, void
|
|
name.hash = novfs_internal_hash(&name);
|
|
cp += (name.len + 1);
|
|
|
|
- pinfo =
|
|
- kmalloc(sizeof(struct novfs_entry_info) +
|
|
- PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
+ pinfo = kmalloc(sizeof(struct novfs_entry_info) + PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
pinfo->mode = S_IFDIR | 0700;
|
|
pinfo->size = 0;
|
|
- pinfo->atime = pinfo->ctime = pinfo->mtime =
|
|
- CURRENT_TIME;
|
|
+ pinfo->atime = pinfo->ctime = pinfo->mtime = CURRENT_TIME;
|
|
strcpy(pinfo->name, name.name);
|
|
pinfo->namelength = name.len;
|
|
|
|
novfs_Dump_Info(pinfo);
|
|
|
|
- filldir(dirent, pinfo->name, pinfo->namelength,
|
|
- file->f_pos, file->f_pos, pinfo->mode >> 12);
|
|
+ filldir(dirent, pinfo->name, pinfo->namelength, file->f_pos, file->f_pos, pinfo->mode >> 12);
|
|
file->f_pos += 1;
|
|
|
|
kfree(pinfo);
|
|
@@ -1091,8 +996,7 @@ void processList(struct file *file, void
|
|
}
|
|
}
|
|
|
|
-int processEntries(struct file *file, void *dirent, filldir_t filldir,
|
|
- void ** enumHandle, struct novfs_schandle sessionId)
|
|
+int processEntries(struct file *file, void *dirent, filldir_t filldir, void **enumHandle, struct novfs_schandle sessionId)
|
|
{
|
|
unsigned char *path = NULL, *buf = NULL;
|
|
int count = 0, status = 0;
|
|
@@ -1111,9 +1015,7 @@ int processEntries(struct file *file, vo
|
|
}
|
|
//NWSearchfiles
|
|
count = 0;
|
|
- status =
|
|
- novfs_get_dir_listex(path, enumHandle, &count, &pinfo,
|
|
- sessionId);
|
|
+ status = novfs_get_dir_listex(path, enumHandle, &count, &pinfo, sessionId);
|
|
pInfoMem = pinfo;
|
|
|
|
if ((count == -1) || (count == 0) || (status != 0)) {
|
|
@@ -1123,11 +1025,10 @@ int processEntries(struct file *file, vo
|
|
}
|
|
// parse resultset
|
|
while (pinfo && count--) {
|
|
- filldir(dirent, pinfo->name, pinfo->namelength, file->f_pos,
|
|
- file->f_pos, pinfo->mode >> 12);
|
|
+ filldir(dirent, pinfo->name, pinfo->namelength, file->f_pos, file->f_pos, pinfo->mode >> 12);
|
|
file->f_pos += 1;
|
|
|
|
- pinfo = (struct novfs_entry_info *) (pinfo->name + pinfo->namelength);
|
|
+ pinfo = (struct novfs_entry_info *)(pinfo->name + pinfo->namelength);
|
|
}
|
|
|
|
kfree(pInfoMem);
|
|
@@ -1146,9 +1047,8 @@ int novfs_dir_readdir(struct file *file,
|
|
struct file_private *file_private = NULL;
|
|
int lComm;
|
|
|
|
- file_private = (struct file_private *) file->private_data;
|
|
- DbgPrint("Name %.*s", file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name);
|
|
+ file_private = (struct file_private *)file->private_data;
|
|
+ DbgPrint("Name %.*s", file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
//printk("<1> file = %.*s\n", file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
@@ -1168,8 +1068,7 @@ int novfs_dir_readdir(struct file *file,
|
|
file_private->listedall = 1;
|
|
} else {
|
|
if (inHAX) {
|
|
- if (get_nanosecond_time() - inHAXTime >
|
|
- 100 * 1000 * 1000) {
|
|
+ if (get_nanosecond_time() - inHAXTime > 100 * 1000 * 1000) {
|
|
//printk("<1> xoverhack: it was long, long, long ago...\n");
|
|
inHAX = 0;
|
|
} else {
|
|
@@ -1187,17 +1086,14 @@ int novfs_dir_readdir(struct file *file,
|
|
#endif
|
|
|
|
if (file->f_pos == 0) {
|
|
- if (filldir(dirent, ".", 1, file->f_pos, inode->i_ino, DT_DIR) <
|
|
- 0)
|
|
+ if (filldir(dirent, ".", 1, file->f_pos, inode->i_ino, DT_DIR) < 0)
|
|
return 1;
|
|
file->f_pos++;
|
|
return 1;
|
|
}
|
|
|
|
if (file->f_pos == 1) {
|
|
- if (filldir
|
|
- (dirent, "..", 2, file->f_pos,
|
|
- file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
|
|
+ if (filldir(dirent, "..", 2, file->f_pos, file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
|
|
return 1;
|
|
file->f_pos++;
|
|
return 1;
|
|
@@ -1209,17 +1105,12 @@ int novfs_dir_readdir(struct file *file,
|
|
|
|
inode = file->f_dentry->d_inode;
|
|
if (inode && inode->i_private) {
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->
|
|
- Scope);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
if (0 == SC_PRESENT(sessionId)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
}
|
|
- uid = novfs_scope_get_uid(((struct inode_data *) inode->i_private)->Scope);
|
|
+ uid = novfs_scope_get_uid(((struct inode_data *)inode->i_private)->Scope);
|
|
} else {
|
|
SC_INITIALIZE(sessionId);
|
|
uid = current_euid();
|
|
@@ -1239,17 +1130,14 @@ int novfs_dir_readdir(struct file *file,
|
|
type = SERVER_LIST;
|
|
} else {
|
|
DbgPrint("Parent-Parent is Root directory");
|
|
- novfs_get_vols(&file->f_dentry->d_name,
|
|
- &list, sessionId);
|
|
+ novfs_get_vols(&file->f_dentry->d_name, &list, sessionId);
|
|
type = VOLUME_LIST;
|
|
}
|
|
|
|
processList(file, dirent, filldir, list, type, sessionId);
|
|
file_private->listedall = 1;
|
|
} else {
|
|
- status =
|
|
- processEntries(file, dirent, filldir,
|
|
- &file_private->enumHandle, sessionId);
|
|
+ status = processEntries(file, dirent, filldir, &file_private->enumHandle, sessionId);
|
|
|
|
if (status != 0) {
|
|
file_private->listedall = 1;
|
|
@@ -1257,15 +1145,10 @@ int novfs_dir_readdir(struct file *file,
|
|
// Hack for crossover part 2 - begin
|
|
lComm = strlen(current->comm);
|
|
if ((lComm > 4)
|
|
- && (0 ==
|
|
- strcmp(current->comm + lComm - 4, ".EXE"))) {
|
|
- if (filldir
|
|
- (dirent, " !xover", 7, file->f_pos,
|
|
- inode->i_ino, DT_DIR) < 0)
|
|
+ && (0 == strcmp(current->comm + lComm - 4, ".EXE"))) {
|
|
+ if (filldir(dirent, " !xover", 7, file->f_pos, inode->i_ino, DT_DIR) < 0)
|
|
return 1;
|
|
- if (filldir
|
|
- (dirent, "z!xover", 7, file->f_pos,
|
|
- inode->i_ino, DT_DIR) < 0)
|
|
+ if (filldir(dirent, "z!xover", 7, file->f_pos, inode->i_ino, DT_DIR) < 0)
|
|
return 1;
|
|
file->f_pos += 2;
|
|
}
|
|
@@ -1293,33 +1176,24 @@ ssize_t novfs_f_read(struct file * file,
|
|
struct novfs_schandle session;
|
|
struct inode_data *id;
|
|
|
|
- if (file->f_dentry &&
|
|
- (inode = file->f_dentry->d_inode) &&
|
|
- (id = (struct inode_data *) inode->i_private)) {
|
|
+ if (file->f_dentry && (inode = file->f_dentry->d_inode) && (id = (struct inode_data *)inode->i_private)) {
|
|
|
|
DbgPrint("(0x%p 0x%p %d %lld %.*s)",
|
|
- file->private_data,
|
|
- buf, len, offset,
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name);
|
|
+ file->private_data, buf, len, offset, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
if (novfs_page_cache && !(file->f_flags & O_DIRECT) && id->CacheFlag) {
|
|
totalread = do_sync_read(file, buf, len, off);
|
|
} else {
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- id->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
+ id->Scope = novfs_get_scope(file->f_dentry);
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
}
|
|
|
|
while (len > 0 && (offset < i_size_read(inode))) {
|
|
int retval;
|
|
thisread = len;
|
|
- retval =
|
|
- novfs_read_file(file->private_data, buf,
|
|
- &thisread, &offset,
|
|
- session);
|
|
+ retval = novfs_read_file(file->private_data, buf, &thisread, &offset, session);
|
|
if (retval || !thisread) {
|
|
if (retval) {
|
|
totalread = retval;
|
|
@@ -1340,8 +1214,7 @@ ssize_t novfs_f_read(struct file * file,
|
|
return (totalread);
|
|
}
|
|
|
|
-ssize_t novfs_f_write(struct file * file, const char *buf, size_t len,
|
|
- loff_t * off)
|
|
+ssize_t novfs_f_write(struct file * file, const char *buf, size_t len, loff_t * off)
|
|
{
|
|
ssize_t thiswrite, totalwrite = 0;
|
|
loff_t offset = *off;
|
|
@@ -1350,30 +1223,23 @@ ssize_t novfs_f_write(struct file * file
|
|
int status;
|
|
struct inode_data *id;
|
|
|
|
- if (file->f_dentry &&
|
|
- (inode = file->f_dentry->d_inode) &&
|
|
- (id = file->f_dentry->d_inode->i_private)) {
|
|
+ if (file->f_dentry && (inode = file->f_dentry->d_inode) && (id = file->f_dentry->d_inode->i_private)) {
|
|
DbgPrint("(0x%p 0x%p 0x%p %d %lld %.*s)",
|
|
file->private_data, inode, id->FileHandle, len, offset,
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name);
|
|
+ file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
- if (novfs_page_cache &&
|
|
- !(file->f_flags & O_DIRECT) &&
|
|
- id->CacheFlag && !(file->f_flags & O_WRONLY)) {
|
|
+ if (novfs_page_cache && !(file->f_flags & O_DIRECT) && id->CacheFlag && !(file->f_flags & O_WRONLY)) {
|
|
totalwrite = do_sync_write(file, buf, len, off);
|
|
} else {
|
|
if (file->f_flags & O_APPEND) {
|
|
offset = i_size_read(inode);
|
|
DbgPrint("appending to end %lld %.*s",
|
|
- offset, file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name);
|
|
+ offset, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
}
|
|
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- id->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
+ id->Scope = novfs_get_scope(file->f_dentry);
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
}
|
|
|
|
@@ -1381,23 +1247,18 @@ ssize_t novfs_f_write(struct file * file
|
|
thiswrite = len;
|
|
if ((status =
|
|
novfs_write_file(file->private_data,
|
|
- (unsigned char *)buf,
|
|
- &thiswrite, &offset,
|
|
- session)) || !thiswrite) {
|
|
+ (unsigned char *)buf, &thiswrite, &offset, session)) || !thiswrite) {
|
|
totalwrite = status;
|
|
break;
|
|
}
|
|
- DbgPrint("thiswrite = 0x%x",
|
|
- thiswrite);
|
|
+ DbgPrint("thiswrite = 0x%x", thiswrite);
|
|
len -= thiswrite;
|
|
buf += thiswrite;
|
|
offset += thiswrite;
|
|
totalwrite += thiswrite;
|
|
if (offset > i_size_read(inode)) {
|
|
i_size_write(inode, offset);
|
|
- inode->i_blocks =
|
|
- (offset + inode->i_sb->s_blocksize -
|
|
- 1) >> inode->i_blkbits;
|
|
+ inode->i_blocks = (offset + inode->i_sb->s_blocksize - 1) >> inode->i_blkbits;
|
|
}
|
|
inode->i_mtime = inode->i_atime = CURRENT_TIME;
|
|
id->Flags |= UPDATE_INODE;
|
|
@@ -1416,8 +1277,7 @@ int novfs_f_readdir(struct file *file, v
|
|
return -EISDIR;
|
|
}
|
|
|
|
-int novfs_f_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|
- unsigned long arg)
|
|
+int novfs_f_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
|
|
{
|
|
DbgPrint("file=0x%p cmd=0x%x arg=0x%p", file, cmd, arg);
|
|
|
|
@@ -1428,8 +1288,7 @@ int novfs_f_mmap(struct file *file, stru
|
|
{
|
|
int retCode = -EINVAL;
|
|
|
|
- DbgPrint("file=0x%p %.*s", file, file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name);
|
|
+ DbgPrint("file=0x%p %.*s", file, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
retCode = generic_file_mmap(file, vma);
|
|
|
|
@@ -1449,80 +1308,56 @@ int novfs_f_open(struct inode *inode, st
|
|
int errInfo;
|
|
|
|
DbgPrint("inode=0x%p file=0x%p dentry=0x%p dentry->d_inode=0x%p %.*s",
|
|
- inode, file, file->f_dentry, file->f_dentry->d_inode,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
+ inode, file, file->f_dentry, file->f_dentry->d_inode, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
if (file->f_dentry) {
|
|
DbgPrint("%.*s f_flags=0%o f_mode=0%o i_mode=0%o",
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name,
|
|
- file->f_flags, file->f_mode, inode->i_mode);
|
|
+ file->f_dentry->d_name.len, file->f_dentry->d_name.name, file->f_flags, file->f_mode, inode->i_mode);
|
|
}
|
|
|
|
if (inode && inode->i_private) {
|
|
- id = (struct inode_data *) file->f_dentry->d_inode->i_private;
|
|
+ id = (struct inode_data *)file->f_dentry->d_inode->i_private;
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
id->Scope = novfs_get_scope(file->f_dentry);
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
}
|
|
|
|
- info = kmalloc(sizeof(struct novfs_entry_info) +
|
|
- PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
+ info = kmalloc(sizeof(struct novfs_entry_info) + PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (info) {
|
|
- path =
|
|
- novfs_dget_path(file->f_dentry, info->name,
|
|
- PATH_LENGTH_BUFFER);
|
|
+ path = novfs_dget_path(file->f_dentry, info->name, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
if (file->f_flags & O_TRUNC) {
|
|
- errInfo =
|
|
- novfs_get_file_info(path, info,
|
|
- session);
|
|
+ errInfo = novfs_get_file_info(path, info, session);
|
|
|
|
if (errInfo || info->size == 0) {
|
|
// clear O_TRUNC flag, bug #275366
|
|
- file->f_flags =
|
|
- file->f_flags & (~O_TRUNC);
|
|
+ file->f_flags = file->f_flags & (~O_TRUNC);
|
|
}
|
|
}
|
|
|
|
DbgPrint("%s", path);
|
|
- retCode = novfs_open_file(path,
|
|
- file->
|
|
- f_flags & ~O_EXCL,
|
|
- info,
|
|
- &file->private_data,
|
|
- session);
|
|
+ retCode = novfs_open_file(path, file->f_flags & ~O_EXCL, info, &file->private_data, session);
|
|
|
|
- DbgPrint("0x%x 0x%p", retCode,
|
|
- file->private_data);
|
|
+ DbgPrint("0x%x 0x%p", retCode, file->private_data);
|
|
if (!retCode) {
|
|
/*
|
|
*update_inode(inode, &info);
|
|
*/
|
|
//id->FileHandle = file->private_data;
|
|
- id->CacheFlag =
|
|
- novfs_get_file_cache_flag(path,
|
|
- session);
|
|
+ id->CacheFlag = novfs_get_file_cache_flag(path, session);
|
|
|
|
- if (!novfs_get_file_info
|
|
- (path, info, session)) {
|
|
+ if (!novfs_get_file_info(path, info, session)) {
|
|
update_inode(inode, info);
|
|
}
|
|
|
|
parent = dget_parent(file->f_dentry);
|
|
|
|
if (parent && parent->d_inode) {
|
|
- struct inode *dir =
|
|
- parent->d_inode;
|
|
+ struct inode *dir = parent->d_inode;
|
|
novfs_lock_inode_cache(dir);
|
|
ino = 0;
|
|
- if (novfs_get_entry
|
|
- (dir,
|
|
- &file->f_dentry->d_name,
|
|
- &ino, info)) {
|
|
- ((struct inode_data *) inode->
|
|
- i_private)->Flags |=
|
|
- UPDATE_INODE;
|
|
+ if (novfs_get_entry(dir, &file->f_dentry->d_name, &ino, info)) {
|
|
+ ((struct inode_data *)inode->i_private)->Flags |= UPDATE_INODE;
|
|
}
|
|
|
|
novfs_unlock_inode_cache(dir);
|
|
@@ -1537,8 +1372,7 @@ int novfs_f_open(struct inode *inode, st
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_flush_mapping(void *Handle, struct address_space *mapping,
|
|
- struct novfs_schandle Session)
|
|
+int novfs_flush_mapping(void *Handle, struct address_space *mapping, struct novfs_schandle Session)
|
|
{
|
|
struct pagevec pagevec;
|
|
unsigned nrpages;
|
|
@@ -1549,10 +1383,7 @@ int novfs_flush_mapping(void *Handle, st
|
|
|
|
do {
|
|
done = 1;
|
|
- nrpages = pagevec_lookup_tag(&pagevec,
|
|
- mapping,
|
|
- &index,
|
|
- PAGECACHE_TAG_DIRTY, PAGEVEC_SIZE);
|
|
+ nrpages = pagevec_lookup_tag(&pagevec, mapping, &index, PAGECACHE_TAG_DIRTY, PAGEVEC_SIZE);
|
|
|
|
if (nrpages) {
|
|
struct page *page;
|
|
@@ -1570,16 +1401,11 @@ int novfs_flush_mapping(void *Handle, st
|
|
page_cache_get(page);
|
|
if (page->mapping == mapping) {
|
|
if (clear_page_dirty_for_io(page)) {
|
|
- rc = novfs_write_page(Handle,
|
|
- page,
|
|
- Session);
|
|
+ rc = novfs_write_page(Handle, page, Session);
|
|
if (!rc) {
|
|
//ClearPageDirty(page);
|
|
radix_tree_tag_clear
|
|
- (&mapping->
|
|
- page_tree,
|
|
- page_index(page),
|
|
- PAGECACHE_TAG_DIRTY);
|
|
+ (&mapping->page_tree, page_index(page), PAGECACHE_TAG_DIRTY);
|
|
}
|
|
}
|
|
}
|
|
@@ -1613,41 +1439,27 @@ int novfs_f_flush(struct file *file, fl_
|
|
inode = file->f_dentry->d_inode;
|
|
DbgPrint("%.*s f_flags=0%o f_mode=0%o i_mode=0%o",
|
|
file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name, file->f_flags,
|
|
- file->f_mode, inode->i_mode);
|
|
+ file->f_dentry->d_name.name, file->f_flags, file->f_mode, inode->i_mode);
|
|
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- id->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
+ id->Scope = novfs_get_scope(file->f_dentry);
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
}
|
|
|
|
- if (inode &&
|
|
- inode->i_mapping && inode->i_mapping->nrpages) {
|
|
+ if (inode && inode->i_mapping && inode->i_mapping->nrpages) {
|
|
|
|
DbgPrint("%.*s pages=%lu",
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name,
|
|
- inode->i_mapping->nrpages);
|
|
+ file->f_dentry->d_name.len, file->f_dentry->d_name.name, inode->i_mapping->nrpages);
|
|
|
|
if (file->f_dentry &&
|
|
file->f_dentry->d_inode &&
|
|
file->f_dentry->d_inode->i_mapping &&
|
|
file->f_dentry->d_inode->i_mapping->a_ops &&
|
|
- file->f_dentry->d_inode->i_mapping->a_ops->
|
|
- writepage) {
|
|
- rc = filemap_fdatawrite(file->f_dentry->
|
|
- d_inode->
|
|
- i_mapping);
|
|
+ file->f_dentry->d_inode->i_mapping->a_ops->writepage) {
|
|
+ rc = filemap_fdatawrite(file->f_dentry->d_inode->i_mapping);
|
|
} else {
|
|
- rc = novfs_flush_mapping(file->
|
|
- private_data,
|
|
- file->
|
|
- f_dentry->
|
|
- d_inode->
|
|
- i_mapping,
|
|
- session);
|
|
+ rc = novfs_flush_mapping(file->private_data, file->f_dentry->d_inode->i_mapping, session);
|
|
}
|
|
}
|
|
}
|
|
@@ -1662,9 +1474,7 @@ int novfs_f_release(struct inode *inode,
|
|
struct novfs_schandle session;
|
|
struct inode_data *id;
|
|
|
|
- DbgPrint("path=%.*s handle=%p",
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name, file->private_data);
|
|
+ DbgPrint("path=%.*s handle=%p", file->f_dentry->d_name.len, file->f_dentry->d_name.name, file->private_data);
|
|
|
|
if (inode && (id = inode->i_private)) {
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
@@ -1675,26 +1485,18 @@ int novfs_f_release(struct inode *inode,
|
|
|
|
if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
|
|
DbgPrint("%.*s f_flags=0%o f_mode=0%o i_mode=0%o",
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name, file->f_flags,
|
|
- file->f_mode, inode->i_mode);
|
|
+ file->f_dentry->d_name.len,
|
|
+ file->f_dentry->d_name.name, file->f_flags, file->f_mode, inode->i_mode);
|
|
|
|
if (inode->i_mapping && inode->i_mapping->nrpages) {
|
|
|
|
DbgPrint("%.*s pages=%lu",
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name,
|
|
- inode->i_mapping->nrpages);
|
|
-
|
|
- if (inode->i_mapping->a_ops &&
|
|
- inode->i_mapping->a_ops->writepage) {
|
|
- filemap_fdatawrite(file->f_dentry->
|
|
- d_inode->i_mapping);
|
|
+ file->f_dentry->d_name.len, file->f_dentry->d_name.name, inode->i_mapping->nrpages);
|
|
+
|
|
+ if (inode->i_mapping->a_ops && inode->i_mapping->a_ops->writepage) {
|
|
+ filemap_fdatawrite(file->f_dentry->d_inode->i_mapping);
|
|
} else {
|
|
- novfs_flush_mapping(file->private_data,
|
|
- file->f_dentry->
|
|
- d_inode->i_mapping,
|
|
- session);
|
|
+ novfs_flush_mapping(file->private_data, file->f_dentry->d_inode->i_mapping, session);
|
|
}
|
|
}
|
|
}
|
|
@@ -1717,8 +1519,7 @@ int novfs_f_fsync(struct file *file, int
|
|
int novfs_f_llseek(struct file *file, loff_t offset, int origin)
|
|
{
|
|
DbgPrint("File=0x%p Name=%.*s offset=%lld origin=%d",
|
|
- file, file->f_dentry->d_name.len, file->f_dentry->d_name.name,
|
|
- offset, origin);
|
|
+ file, file->f_dentry->d_name.len, file->f_dentry->d_name.name, offset, origin);
|
|
return (generic_file_llseek(file, offset, origin));
|
|
}
|
|
|
|
@@ -1756,12 +1557,9 @@ int novfs_f_lock(struct file *file, int
|
|
struct inode_data *id;
|
|
loff_t len;
|
|
|
|
- DbgPrint("(0x%p): begin in novfs_f_lock 0x%p",
|
|
- __builtin_return_address(0), file->private_data);
|
|
- DbgPrint("cmd = %d, F_GETLK = %d, F_SETLK = %d, F_SETLKW = %d",
|
|
- cmd, F_GETLK, F_SETLK, F_SETLKW);
|
|
- DbgPrint("lock->fl_start = 0x%llX, lock->fl_end = 0x%llX",
|
|
- lock->fl_start, lock->fl_end);
|
|
+ DbgPrint("(0x%p): begin in novfs_f_lock 0x%p", __builtin_return_address(0), file->private_data);
|
|
+ DbgPrint("cmd = %d, F_GETLK = %d, F_SETLK = %d, F_SETLKW = %d", cmd, F_GETLK, F_SETLK, F_SETLKW);
|
|
+ DbgPrint("lock->fl_start = 0x%llX, lock->fl_end = 0x%llX", lock->fl_start, lock->fl_end);
|
|
|
|
err_code = -1;
|
|
if (lock->fl_start <= lock->fl_end) {
|
|
@@ -1771,18 +1569,13 @@ int novfs_f_lock(struct file *file, int
|
|
len = 0;
|
|
}
|
|
|
|
- if (file->f_dentry &&
|
|
- (inode = file->f_dentry->d_inode) &&
|
|
- (id = (struct inode_data *) inode->i_private)) {
|
|
+ if (file->f_dentry && (inode = file->f_dentry->d_inode) && (id = (struct inode_data *)inode->i_private)) {
|
|
DbgPrint("(0x%p 0x%p %.*s)",
|
|
- file->private_data, inode,
|
|
- file->f_dentry->d_name.len,
|
|
- file->f_dentry->d_name.name);
|
|
+ file->private_data, inode, file->f_dentry->d_name.len, file->f_dentry->d_name.name);
|
|
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- id->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
+ id->Scope = novfs_get_scope(file->f_dentry);
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
}
|
|
|
|
@@ -1793,22 +1586,14 @@ int novfs_f_lock(struct file *file, int
|
|
case F_SETLK64:
|
|
#endif
|
|
|
|
- err_code =
|
|
- novfs_set_file_lock(session,
|
|
- file->private_data,
|
|
- lock->fl_type,
|
|
- lock->fl_start, len);
|
|
+ err_code = novfs_set_file_lock(session, file->private_data, lock->fl_type, lock->fl_start, len);
|
|
break;
|
|
|
|
case F_SETLKW:
|
|
#ifdef F_GETLK64
|
|
case F_SETLKW64:
|
|
#endif
|
|
- err_code =
|
|
- novfs_set_file_lock(session,
|
|
- file->private_data,
|
|
- lock->fl_type,
|
|
- lock->fl_start, len);
|
|
+ err_code = novfs_set_file_lock(session, file->private_data, lock->fl_type, lock->fl_start, len);
|
|
break;
|
|
|
|
case F_GETLK:
|
|
@@ -1822,17 +1607,13 @@ int novfs_f_lock(struct file *file, int
|
|
break;
|
|
|
|
default:
|
|
- printk
|
|
- ("<1> novfs in novfs_f_lock, not implemented cmd = %d\n",
|
|
- cmd);
|
|
- DbgPrint("novfs in novfs_f_lock, not implemented cmd = %d",
|
|
- cmd);
|
|
+ printk("<1> novfs in novfs_f_lock, not implemented cmd = %d\n", cmd);
|
|
+ DbgPrint("novfs in novfs_f_lock, not implemented cmd = %d", cmd);
|
|
break;
|
|
}
|
|
}
|
|
|
|
- DbgPrint("lock->fl_type = %u, err_code 0x%X",
|
|
- lock->fl_type, err_code);
|
|
+ DbgPrint("lock->fl_type = %u, err_code 0x%X", lock->fl_type, err_code);
|
|
|
|
if ((err_code != 0) && (err_code != -1)
|
|
&& (err_code != -ENOSYS)) {
|
|
@@ -1847,8 +1628,7 @@ int novfs_f_lock(struct file *file, int
|
|
|
|
/*++======================================================================*/
|
|
static void novfs_copy_cache_pages(struct address_space *mapping,
|
|
- struct list_head *pages, int bytes_read,
|
|
- char *data, struct pagevec *plru_pvec)
|
|
+ struct list_head *pages, int bytes_read, char *data, struct pagevec *plru_pvec)
|
|
{
|
|
struct page *page;
|
|
char *target;
|
|
@@ -1872,8 +1652,7 @@ static void novfs_copy_cache_pages(struc
|
|
if (PAGE_CACHE_SIZE > bytes_read) {
|
|
memcpy(target, data, bytes_read);
|
|
/* zero the tail end of this partial page */
|
|
- memset(target + bytes_read, 0,
|
|
- PAGE_CACHE_SIZE - bytes_read);
|
|
+ memset(target + bytes_read, 0, PAGE_CACHE_SIZE - bytes_read);
|
|
bytes_read = 0;
|
|
} else {
|
|
memcpy(target, data, PAGE_CACHE_SIZE);
|
|
@@ -1901,7 +1680,7 @@ int novfs_a_writepage(struct page *page,
|
|
struct novfs_data_list dlst[2];
|
|
size_t len = PAGE_CACHE_SIZE;
|
|
|
|
- session = novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
|
|
page_cache_get(page);
|
|
|
|
@@ -1933,8 +1712,7 @@ int novfs_a_writepage(struct page *page,
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_a_writepages(struct address_space *mapping,
|
|
- struct writeback_control *wbc)
|
|
+int novfs_a_writepages(struct address_space *mapping, struct writeback_control *wbc)
|
|
{
|
|
int retCode = 0;
|
|
struct inode *inode = mapping->host;
|
|
@@ -1953,31 +1731,24 @@ int novfs_a_writepages(struct address_sp
|
|
size_t tsize;
|
|
|
|
SC_INITIALIZE(session);
|
|
- DbgPrint("inode=0x%p mapping=0x%p wbc=0x%p nr_to_write=%d",
|
|
- inode, mapping, wbc, wbc->nr_to_write);
|
|
+ DbgPrint("inode=0x%p mapping=0x%p wbc=0x%p nr_to_write=%d", inode, mapping, wbc, wbc->nr_to_write);
|
|
|
|
if (inode) {
|
|
- DbgPrint("Inode=0x%p Ino=%d Id=0x%p", inode, inode->i_ino,
|
|
- inode->i_private);
|
|
+ DbgPrint("Inode=0x%p Ino=%d Id=0x%p", inode, inode->i_ino, inode->i_private);
|
|
|
|
if (NULL != (id = inode->i_private)) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
- fh = ((struct inode_data *) inode->i_private)->FileHandle;
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
+ fh = ((struct inode_data *)inode->i_private)->FileHandle;
|
|
}
|
|
}
|
|
|
|
dlist = kmalloc(sizeof(struct novfs_data_list) * max_page_lookup, GFP_KERNEL);
|
|
- pages =
|
|
- kmalloc(sizeof(struct page *) * max_page_lookup, GFP_KERNEL);
|
|
+ pages = kmalloc(sizeof(struct page *) * max_page_lookup, GFP_KERNEL);
|
|
|
|
if (id)
|
|
- DbgPrint("inode=0x%p fh=0x%p dlist=0x%p pages=0x%p %s",
|
|
- inode, fh, dlist, pages, id->Name);
|
|
+ DbgPrint("inode=0x%p fh=0x%p dlist=0x%p pages=0x%p %s", inode, fh, dlist, pages, id->Name);
|
|
else
|
|
- DbgPrint("inode=0x%p fh=0x%p dlist=0x%p pages=0x%p",
|
|
- inode, fh, dlist, pages);
|
|
+ DbgPrint("inode=0x%p fh=0x%p dlist=0x%p pages=0x%p", inode, fh, dlist, pages);
|
|
|
|
if (dlist && pages) {
|
|
struct backing_dev_info *bdi = mapping->backing_dev_info;
|
|
@@ -2005,8 +1776,7 @@ int novfs_a_writepages(struct address_sp
|
|
|
|
DbgPrint("nr_pages=%d", nr_pages);
|
|
if (!nr_pages) {
|
|
- memset(pages, 0,
|
|
- sizeof(struct page *) * max_page_lookup);
|
|
+ memset(pages, 0, sizeof(struct page *) * max_page_lookup);
|
|
|
|
spin_lock_irq(&mapping->tree_lock);
|
|
|
|
@@ -2016,13 +1786,8 @@ int novfs_a_writepages(struct address_sp
|
|
* the first entry for the reply buffer.
|
|
*/
|
|
nr_pages =
|
|
- radix_tree_gang_lookup_tag(&mapping->
|
|
- page_tree,
|
|
- (void **)pages,
|
|
- index,
|
|
- max_page_lookup -
|
|
- 1,
|
|
- PAGECACHE_TAG_DIRTY);
|
|
+ radix_tree_gang_lookup_tag(&mapping->page_tree,
|
|
+ (void **)pages, index, max_page_lookup - 1, PAGECACHE_TAG_DIRTY);
|
|
|
|
DbgPrint("2; nr_pages=%d\n", nr_pages);
|
|
/*
|
|
@@ -2044,9 +1809,7 @@ int novfs_a_writepages(struct address_sp
|
|
|
|
if (nr_pages) {
|
|
index = pages[nr_pages - 1]->index + 1;
|
|
- pos =
|
|
- (loff_t) pages[0]->
|
|
- index << PAGE_CACHE_SHIFT;
|
|
+ pos = (loff_t) pages[0]->index << PAGE_CACHE_SHIFT;
|
|
}
|
|
|
|
if (!nr_pages) {
|
|
@@ -2062,9 +1825,7 @@ int novfs_a_writepages(struct address_sp
|
|
}
|
|
} else {
|
|
if (pages[i]) {
|
|
- pos =
|
|
- (loff_t) pages[i]->
|
|
- index << PAGE_CACHE_SHIFT;
|
|
+ pos = (loff_t) pages[i]->index << PAGE_CACHE_SHIFT;
|
|
}
|
|
}
|
|
|
|
@@ -2094,8 +1855,7 @@ int novfs_a_writepages(struct address_sp
|
|
if (wbc->sync_mode != WB_SYNC_NONE)
|
|
wait_on_page_writeback(page);
|
|
|
|
- if (page->mapping != mapping
|
|
- || PageWriteback(page)
|
|
+ if (page->mapping != mapping || PageWriteback(page)
|
|
|| !clear_page_dirty_for_io(page)) {
|
|
unlock_page(page);
|
|
continue;
|
|
@@ -2106,8 +1866,7 @@ int novfs_a_writepages(struct address_sp
|
|
dlptr[dlist_idx].len = PAGE_CACHE_SIZE;
|
|
dlptr[dlist_idx].rwflag = DLREAD;
|
|
dlist_idx++;
|
|
- DbgPrint("Add page=0x%p index=0x%lx",
|
|
- page, page->index);
|
|
+ DbgPrint("Add page=0x%p index=0x%lx", page, page->index);
|
|
}
|
|
|
|
DbgPrint("dlist_idx=%d", dlist_idx);
|
|
@@ -2117,13 +1876,10 @@ int novfs_a_writepages(struct address_sp
|
|
* Check size so we don't write pass end of file.
|
|
*/
|
|
if ((pos + tsize) > i_size_read(inode)) {
|
|
- tsize =
|
|
- (size_t) (i_size_read(inode) - pos);
|
|
+ tsize = (size_t) (i_size_read(inode) - pos);
|
|
}
|
|
|
|
- retCode =
|
|
- novfs_write_pages(fh, dlist, dlist_idx + 1,
|
|
- tsize, pos, session);
|
|
+ retCode = novfs_write_pages(fh, dlist, dlist_idx + 1, tsize, pos, session);
|
|
switch (retCode) {
|
|
case 0:
|
|
wbc->nr_to_write -= dlist_idx;
|
|
@@ -2144,13 +1900,11 @@ int novfs_a_writepages(struct address_sp
|
|
unlock_page((struct page *)
|
|
dlptr[dlist_idx - 1].page);
|
|
page_cache_release((struct page *)
|
|
- dlptr[dlist_idx -
|
|
- 1].page);
|
|
- DbgPrint("release page=0x%p index=0x%lx",
|
|
- dlptr[dlist_idx - 1].page,
|
|
- ((struct page *)
|
|
- dlptr[dlist_idx -
|
|
- 1].page)->index);
|
|
+ dlptr[dlist_idx - 1].page);
|
|
+ DbgPrint("release page=0x%p index=0x%lx", dlptr[dlist_idx - 1].page, ((struct page *)
|
|
+ dlptr[dlist_idx -
|
|
+ 1].page)->
|
|
+ index);
|
|
if (!retCode) {
|
|
wbc->nr_to_write--;
|
|
}
|
|
@@ -2189,14 +1943,12 @@ int novfs_a_readpage(struct file *file,
|
|
struct novfs_schandle session;
|
|
|
|
SC_INITIALIZE(session);
|
|
- DbgPrint("File=0x%p Name=%.*s Page=0x%p", file,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name, page);
|
|
+ DbgPrint("File=0x%p Name=%.*s Page=0x%p", file, file->f_dentry->d_name.len, file->f_dentry->d_name.name, page);
|
|
|
|
dentry = file->f_dentry;
|
|
|
|
if (dentry) {
|
|
- DbgPrint("Dentry=0x%p Name=%.*s", dentry, dentry->d_name.len,
|
|
- dentry->d_name.name);
|
|
+ DbgPrint("Dentry=0x%p Name=%.*s", dentry, dentry->d_name.len, dentry->d_name.name);
|
|
if (dentry->d_inode) {
|
|
inode = dentry->d_inode;
|
|
}
|
|
@@ -2206,15 +1958,10 @@ int novfs_a_readpage(struct file *file,
|
|
DbgPrint("Inode=0x%p Ino=%d", inode, inode->i_ino);
|
|
|
|
if (inode->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
}
|
|
}
|
|
}
|
|
@@ -2233,11 +1980,8 @@ int novfs_a_readpage(struct file *file,
|
|
dlst[1].len = PAGE_CACHE_SIZE;
|
|
dlst[1].rwflag = DLWRITE;
|
|
|
|
- DbgPrint("calling= novfs_Read_Pages %lld",
|
|
- offset);
|
|
- retCode =
|
|
- novfs_read_pages(file->private_data, dlst, 2, &len, &offset,
|
|
- session);
|
|
+ DbgPrint("calling= novfs_Read_Pages %lld", offset);
|
|
+ retCode = novfs_read_pages(file->private_data, dlst, 2, &len, &offset, session);
|
|
if (len && (len < PAGE_CACHE_SIZE)) {
|
|
pbuf = kmap_atomic(page, KM_USER0);
|
|
memset(&((char *)pbuf)[len], 0, PAGE_CACHE_SIZE - len);
|
|
@@ -2254,8 +1998,7 @@ int novfs_a_readpage(struct file *file,
|
|
|
|
}
|
|
|
|
-int novfs_a_readpages(struct file *file, struct address_space *mapping,
|
|
- struct list_head *page_lst, unsigned nr_pages)
|
|
+int novfs_a_readpages(struct file *file, struct address_space *mapping, struct list_head *page_lst, unsigned nr_pages)
|
|
{
|
|
int retCode = 0;
|
|
struct inode *inode = NULL;
|
|
@@ -2271,15 +2014,12 @@ int novfs_a_readpages(struct file *file,
|
|
char *rbuf, done = 0;
|
|
SC_INITIALIZE(session);
|
|
|
|
- DbgPrint("File=0x%p Name=%.*s Pages=%d", file,
|
|
- file->f_dentry->d_name.len, file->f_dentry->d_name.name,
|
|
- nr_pages);
|
|
+ DbgPrint("File=0x%p Name=%.*s Pages=%d", file, file->f_dentry->d_name.len, file->f_dentry->d_name.name, nr_pages);
|
|
|
|
dentry = file->f_dentry;
|
|
|
|
if (dentry) {
|
|
- DbgPrint("Dentry=0x%p Name=%.*s", dentry, dentry->d_name.len,
|
|
- dentry->d_name.name);
|
|
+ DbgPrint("Dentry=0x%p Name=%.*s", dentry, dentry->d_name.len, dentry->d_name.name);
|
|
if (dentry->d_inode) {
|
|
inode = dentry->d_inode;
|
|
}
|
|
@@ -2289,15 +2029,10 @@ int novfs_a_readpages(struct file *file,
|
|
DbgPrint("Inode=0x%p Ino=%d", inode, inode->i_ino);
|
|
|
|
if (inode->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
}
|
|
}
|
|
}
|
|
@@ -2321,8 +2056,7 @@ int novfs_a_readpages(struct file *file,
|
|
* Count number of contiguous pages.
|
|
*/
|
|
list_for_each_entry_reverse(tpage, page_lst, lru) {
|
|
- if ((next_index != tpage->index) ||
|
|
- (len >= novfs_max_iosize - PAGE_SIZE)) {
|
|
+ if ((next_index != tpage->index) || (len >= novfs_max_iosize - PAGE_SIZE)) {
|
|
break;
|
|
}
|
|
len += PAGE_SIZE;
|
|
@@ -2337,14 +2071,9 @@ int novfs_a_readpages(struct file *file,
|
|
dllst[1].len = len;
|
|
dllst[1].rwflag = DLWRITE;
|
|
|
|
- DbgPrint("calling novfs_Read_Pages %lld",
|
|
- offset);
|
|
- if (!novfs_read_pages
|
|
- (file->private_data, dllst, 2, &len,
|
|
- &offset, session)) {
|
|
- novfs_copy_cache_pages(mapping,
|
|
- page_lst, len,
|
|
- rbuf, &lru_pvec);
|
|
+ DbgPrint("calling novfs_Read_Pages %lld", offset);
|
|
+ if (!novfs_read_pages(file->private_data, dllst, 2, &len, &offset, session)) {
|
|
+ novfs_copy_cache_pages(mapping, page_lst, len, rbuf, &lru_pvec);
|
|
page_idx += len >> PAGE_CACHE_SHIFT;
|
|
if ((int)(len & PAGE_CACHE_MASK) != len) {
|
|
page_idx++;
|
|
@@ -2362,8 +2091,7 @@ int novfs_a_readpages(struct file *file,
|
|
* Free any remaining pages.
|
|
*/
|
|
while (!list_empty(page_lst)) {
|
|
- struct page *page =
|
|
- list_entry(page_lst->prev, struct page, lru);
|
|
+ struct page *page = list_entry(page_lst->prev, struct page, lru);
|
|
|
|
list_del(&page->lru);
|
|
page_cache_release(page);
|
|
@@ -2381,8 +2109,7 @@ int novfs_a_readpages(struct file *file,
|
|
}
|
|
|
|
int novfs_a_write_begin(struct file *file, struct address_space *mapping,
|
|
- loff_t pos, unsigned len, unsigned flags,
|
|
- struct page **pagep, void **fsdata)
|
|
+ loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata)
|
|
{
|
|
int retVal = 0;
|
|
loff_t offset = pos;
|
|
@@ -2405,8 +2132,7 @@ int novfs_a_write_begin(struct file *fil
|
|
*pagep = page;
|
|
|
|
DbgPrint("File=0x%p Page=0x%p offset=0x%llx From=%u To=%u "
|
|
- "filesize=%lld\n", file, page, offset, from, to,
|
|
- i_size_read(file->f_dentry->d_inode));
|
|
+ "filesize=%lld\n", file, page, offset, from, to, i_size_read(file->f_dentry->d_inode));
|
|
if (!PageUptodate(page)) {
|
|
/*
|
|
* Check to see if whole page
|
|
@@ -2424,17 +2150,11 @@ int novfs_a_write_begin(struct file *fil
|
|
*/
|
|
if (file->f_dentry && file->f_dentry->d_inode) {
|
|
if (file->f_dentry->d_inode->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *)
|
|
- inode->
|
|
- i_private)->
|
|
- Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)
|
|
+ inode->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) inode->
|
|
- i_private)->Scope =
|
|
- novfs_get_scope(file->f_dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(file->f_dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
}
|
|
}
|
|
}
|
|
@@ -2456,10 +2176,8 @@ int novfs_a_write_begin(struct file *fil
|
|
dllst[1].len = len;
|
|
dllst[1].rwflag = DLWRITE;
|
|
|
|
- DbgPrint("calling novfs_Read_Pages %lld",
|
|
- offset);
|
|
- novfs_read_pages(file->private_data, dllst, 2,
|
|
- &len, &offset, session);
|
|
+ DbgPrint("calling novfs_Read_Pages %lld", offset);
|
|
+ novfs_read_pages(file->private_data, dllst, 2, &len, &offset, session);
|
|
|
|
/*
|
|
* Zero unnsed page.
|
|
@@ -2490,8 +2208,7 @@ int novfs_a_write_begin(struct file *fil
|
|
}
|
|
|
|
int novfs_a_write_end(struct file *file, struct address_space *mapping,
|
|
- loff_t pos, unsigned len, unsigned copied,
|
|
- struct page *page, void *fsdata)
|
|
+ loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata)
|
|
{
|
|
int retCode = 0;
|
|
struct inode *inode = page->mapping->host;
|
|
@@ -2507,11 +2224,9 @@ int novfs_a_write_end(struct file *file,
|
|
from = pos & (PAGE_CACHE_SIZE - 1);
|
|
to = from + len;
|
|
|
|
-
|
|
DbgPrint("File=0x%p Page=0x%p offset=0x%x To=%u filesize=%lld",
|
|
file, page, offset, to, i_size_read(file->f_dentry->d_inode));
|
|
- if (file->f_dentry->d_inode
|
|
- && (id = file->f_dentry->d_inode->i_private)) {
|
|
+ if (file->f_dentry->d_inode && (id = file->f_dentry->d_inode->i_private)) {
|
|
session = novfs_scope_get_sessionId(id->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
id->Scope = novfs_get_scope(file->f_dentry);
|
|
@@ -2528,20 +2243,17 @@ int novfs_a_write_end(struct file *file,
|
|
}
|
|
|
|
if (!PageUptodate(page)) {
|
|
- pos =
|
|
- ((loff_t) page->index << PAGE_CACHE_SHIFT) + offset;
|
|
+ pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + offset;
|
|
|
|
if (to < offset) {
|
|
return (retCode);
|
|
}
|
|
dlst[0].page = page;
|
|
- dlst[0].offset = (void *)(unsigned long) offset;
|
|
+ dlst[0].offset = (void *)(unsigned long)offset;
|
|
dlst[0].len = len;
|
|
dlst[0].rwflag = DLREAD;
|
|
|
|
- retCode =
|
|
- novfs_write_pages(id->FileHandle, dlst, 1, len, pos,
|
|
- session);
|
|
+ retCode = novfs_write_pages(id->FileHandle, dlst, 1, len, pos, session);
|
|
|
|
} else {
|
|
set_page_dirty(page);
|
|
@@ -2552,9 +2264,7 @@ int novfs_a_write_end(struct file *file,
|
|
}
|
|
|
|
/*++======================================================================*/
|
|
-ssize_t novfs_a_direct_IO(int rw, struct kiocb * kiocb,
|
|
- const struct iovec * iov,
|
|
- loff_t offset, unsigned long nr_segs)
|
|
+ssize_t novfs_a_direct_IO(int rw, struct kiocb * kiocb, const struct iovec * iov, loff_t offset, unsigned long nr_segs)
|
|
/*
|
|
*
|
|
* Notes: This is a dummy function so that we can allow a file
|
|
@@ -2568,8 +2278,7 @@ ssize_t novfs_a_direct_IO(int rw, struct
|
|
}
|
|
|
|
/*++======================================================================*/
|
|
-int novfs_i_create(struct inode *dir, struct dentry *dentry, int mode,
|
|
- struct nameidata *nd)
|
|
+int novfs_i_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
|
|
{
|
|
char *path, *buf;
|
|
struct novfs_entry_info info;
|
|
@@ -2577,8 +2286,7 @@ int novfs_i_create(struct inode *dir, st
|
|
struct novfs_schandle session;
|
|
int retCode = -EACCES;
|
|
|
|
- DbgPrint("mode=0%o flags=0%o %.*s", mode,
|
|
- nd->NDOPENFLAGS, dentry->d_name.len, dentry->d_name.name);
|
|
+ DbgPrint("mode=0%o flags=0%o %.*s", mode, nd->NDOPENFLAGS, dentry->d_name.len, dentry->d_name.name);
|
|
|
|
if (IS_ROOT(dentry) || /* Root */
|
|
IS_ROOT(dentry->d_parent) || /* User */
|
|
@@ -2589,41 +2297,23 @@ int novfs_i_create(struct inode *dir, st
|
|
|
|
if (mode | S_IFREG) {
|
|
if (dir->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) dir->i_private)->
|
|
- Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)dir->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) dir->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) dir->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)dir->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)dir->i_private)->Scope);
|
|
}
|
|
|
|
buf = kmalloc(PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (buf) {
|
|
- path =
|
|
- novfs_dget_path(dentry, buf,
|
|
- PATH_LENGTH_BUFFER);
|
|
+ path = novfs_dget_path(dentry, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- retCode =
|
|
- novfs_open_file(path,
|
|
- nd->
|
|
- NDOPENFLAGS |
|
|
- O_RDWR, &info,
|
|
- &handle, session);
|
|
+ retCode = novfs_open_file(path, nd->NDOPENFLAGS | O_RDWR, &info, &handle, session);
|
|
if (!retCode && handle) {
|
|
- novfs_close_file(handle,
|
|
- session);
|
|
- if (!novfs_i_mknod
|
|
- (dir, dentry,
|
|
- mode | S_IFREG, 0)) {
|
|
+ novfs_close_file(handle, session);
|
|
+ if (!novfs_i_mknod(dir, dentry, mode | S_IFREG, 0)) {
|
|
if (dentry->d_inode) {
|
|
((struct inode_data *)
|
|
- dentry->
|
|
- d_inode->
|
|
- i_private)->
|
|
- Flags |= UPDATE_INODE;
|
|
+ dentry->d_inode->i_private)->Flags |= UPDATE_INODE;
|
|
}
|
|
}
|
|
}
|
|
@@ -2643,21 +2333,16 @@ void update_inode(struct inode *Inode, s
|
|
|
|
DbgPrint("atime=%s", ctime_r(&Info->atime.tv_sec, dbuf));
|
|
DbgPrint("ctime=%s", ctime_r(&Info->ctime.tv_sec, dbuf));
|
|
- DbgPrint("mtime=%s %d", ctime_r(&Info->mtime.tv_sec, dbuf),
|
|
- Info->mtime.tv_nsec);
|
|
+ DbgPrint("mtime=%s %d", ctime_r(&Info->mtime.tv_sec, dbuf), Info->mtime.tv_nsec);
|
|
DbgPrint("size=%lld", Info->size);
|
|
DbgPrint("mode=0%o", Info->mode);
|
|
|
|
if (Inode &&
|
|
((Inode->i_size != Info->size) ||
|
|
- (Inode->i_mtime.tv_sec != Info->mtime.tv_sec) ||
|
|
- (Inode->i_mtime.tv_nsec != Info->mtime.tv_nsec))) {
|
|
- DbgPrint ("calling invalidate_remote_inode sz %d %d",
|
|
- Inode->i_size, Info->size);
|
|
- DbgPrint ("calling invalidate_remote_inode sec %d %d",
|
|
- Inode->i_mtime.tv_sec, Info->mtime.tv_sec);
|
|
- DbgPrint ("calling invalidate_remote_inode ns %d %d",
|
|
- Inode->i_mtime.tv_nsec, Info->mtime.tv_nsec);
|
|
+ (Inode->i_mtime.tv_sec != Info->mtime.tv_sec) || (Inode->i_mtime.tv_nsec != Info->mtime.tv_nsec))) {
|
|
+ DbgPrint("calling invalidate_remote_inode sz %d %d", Inode->i_size, Info->size);
|
|
+ DbgPrint("calling invalidate_remote_inode sec %d %d", Inode->i_mtime.tv_sec, Info->mtime.tv_sec);
|
|
+ DbgPrint("calling invalidate_remote_inode ns %d %d", Inode->i_mtime.tv_nsec, Info->mtime.tv_nsec);
|
|
|
|
if (Inode && Inode->i_mapping) {
|
|
invalidate_remote_inode(Inode);
|
|
@@ -2679,8 +2364,8 @@ void update_inode(struct inode *Inode, s
|
|
*
|
|
* Update i_blocks to have the number of 512 blocks
|
|
*/
|
|
- Inode->i_blocks = (((loff_t)Info->size) + Inode->i_sb->s_blocksize - 1)
|
|
- >> (loff_t)Inode->i_blkbits;
|
|
+ Inode->i_blocks = (((loff_t) Info->size) + Inode->i_sb->s_blocksize - 1)
|
|
+ >> (loff_t) Inode->i_blkbits;
|
|
Inode->i_blocks = Inode->i_blocks << (PAGE_CACHE_SHIFT - 9);
|
|
Inode->i_bytes = Info->size & (Inode->i_sb->s_blocksize - 1);
|
|
|
|
@@ -2691,8 +2376,7 @@ void update_inode(struct inode *Inode, s
|
|
}
|
|
}
|
|
|
|
-struct dentry *novfs_i_lookup(struct inode *dir, struct dentry *dentry,
|
|
- struct nameidata *nd)
|
|
+struct dentry *novfs_i_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
|
|
{
|
|
struct dentry *retVal = ERR_PTR(-ENOENT);
|
|
struct dentry *parent;
|
|
@@ -2709,15 +2393,12 @@ struct dentry *novfs_i_lookup(struct ino
|
|
char *path;
|
|
path = novfs_dget_path(dentry, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- DbgPrint("dir 0x%p %d hash %d inode 0x%0p %s",
|
|
- dir, dir->i_ino, dentry->d_name.hash,
|
|
- dentry->d_inode, path);
|
|
+ DbgPrint("dir 0x%p %d hash %d inode 0x%0p %s", dir, dir->i_ino, dentry->d_name.hash, dentry->d_inode, path);
|
|
}
|
|
kfree(buf);
|
|
} else {
|
|
DbgPrint("dir 0x%p %d name %.*s hash %d inode 0x%0p",
|
|
- dir, dir->i_ino, dentry->d_name.len, dentry->d_name.name,
|
|
- dentry->d_name.hash, dentry->d_inode);
|
|
+ dir, dir->i_ino, dentry->d_name.len, dentry->d_name.name, dentry->d_name.hash, dentry->d_inode);
|
|
}
|
|
|
|
if ((dentry->d_name.len == 7)
|
|
@@ -2742,27 +2423,18 @@ struct dentry *novfs_i_lookup(struct ino
|
|
inode = novfs_root->d_inode;
|
|
return (0);
|
|
} else {
|
|
- info =
|
|
- kmalloc(sizeof(struct novfs_entry_info) +
|
|
- PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
+ info = kmalloc(sizeof(struct novfs_entry_info) + PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (info) {
|
|
- if (NULL ==
|
|
- (retVal =
|
|
- ERR_PTR(verify_dentry(dentry, 1)))) {
|
|
+ if (NULL == (retVal = ERR_PTR(verify_dentry(dentry, 1)))) {
|
|
name.name = dentry->d_name.name;
|
|
name.len = dentry->d_name.len;
|
|
name.hash = novfs_internal_hash(&name);
|
|
|
|
if (novfs_lock_inode_cache(dir)) {
|
|
- if (!novfs_get_entry
|
|
- (dir, &name, &ino, info)) {
|
|
- inode =
|
|
- ilookup(dentry->
|
|
- d_sb, ino);
|
|
+ if (!novfs_get_entry(dir, &name, &ino, info)) {
|
|
+ inode = ilookup(dentry->d_sb, ino);
|
|
if (inode) {
|
|
- update_inode
|
|
- (inode,
|
|
- info);
|
|
+ update_inode(inode, info);
|
|
}
|
|
}
|
|
novfs_unlock_inode_cache(dir);
|
|
@@ -2775,16 +2447,13 @@ struct dentry *novfs_i_lookup(struct ino
|
|
uid = novfs_scope_get_uid(novfs_get_scope(dentry));
|
|
}
|
|
if (novfs_lock_inode_cache(dir)) {
|
|
- inode = novfs_get_inode (dentry->d_sb, info->mode, 0, uid, ino, &name);
|
|
+ inode = novfs_get_inode(dentry->d_sb, info->mode, 0, uid, ino, &name);
|
|
if (inode) {
|
|
if (!novfs_get_entry(dir, &dentry->d_name, &ino, info)) {
|
|
- update_inode
|
|
- (inode,
|
|
- info);
|
|
+ update_inode(inode, info);
|
|
}
|
|
}
|
|
- novfs_unlock_inode_cache
|
|
- (dir);
|
|
+ novfs_unlock_inode_cache(dir);
|
|
}
|
|
}
|
|
}
|
|
@@ -2806,8 +2475,7 @@ struct dentry *novfs_i_lookup(struct ino
|
|
if (info)
|
|
kfree(info);
|
|
|
|
- DbgPrint("inode=0x%p dentry->d_inode=0x%p return=0x%p",
|
|
- dir, dentry->d_inode, retVal);
|
|
+ DbgPrint("inode=0x%p dentry->d_inode=0x%p return=0x%p", dir, dentry->d_inode, retVal);
|
|
|
|
return (retVal);
|
|
}
|
|
@@ -2820,15 +2488,11 @@ int novfs_i_unlink(struct inode *dir, st
|
|
char *path, *buf;
|
|
uint64_t t64;
|
|
|
|
- DbgPrint("dir=0x%p dir->i_ino=%d %.*s", dir,
|
|
- dir->i_ino, dentry->d_name.len, dentry->d_name.name);
|
|
+ DbgPrint("dir=0x%p dir->i_ino=%d %.*s", dir, dir->i_ino, dentry->d_name.len, dentry->d_name.name);
|
|
DbgPrint("IS_ROOT(dentry)=%d", IS_ROOT(dentry));
|
|
- DbgPrint("IS_ROOT(dentry->d_parent)=%d",
|
|
- IS_ROOT(dentry->d_parent));
|
|
- DbgPrint("IS_ROOT(dentry->d_parent->d_parent)=%d",
|
|
- IS_ROOT(dentry->d_parent->d_parent));
|
|
- DbgPrint("IS_ROOT(dentry->d_parent->d_parent->d_parent)=%d",
|
|
- IS_ROOT(dentry->d_parent->d_parent->d_parent));
|
|
+ DbgPrint("IS_ROOT(dentry->d_parent)=%d", IS_ROOT(dentry->d_parent));
|
|
+ DbgPrint("IS_ROOT(dentry->d_parent->d_parent)=%d", IS_ROOT(dentry->d_parent->d_parent));
|
|
+ DbgPrint("IS_ROOT(dentry->d_parent->d_parent->d_parent)=%d", IS_ROOT(dentry->d_parent->d_parent->d_parent));
|
|
|
|
if (IS_ROOT(dentry) || /* Root */
|
|
IS_ROOT(dentry->d_parent) || /* User */
|
|
@@ -2839,34 +2503,23 @@ int novfs_i_unlink(struct inode *dir, st
|
|
|
|
inode = dentry->d_inode;
|
|
if (inode) {
|
|
- DbgPrint("dir=0x%p dir->i_ino=%d inode=0x%p ino=%d",
|
|
- dir, dir->i_ino, inode, inode->i_ino);
|
|
+ DbgPrint("dir=0x%p dir->i_ino=%d inode=0x%p ino=%d", dir, dir->i_ino, inode, inode->i_ino);
|
|
if (inode->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
}
|
|
|
|
buf = kmalloc(PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (buf) {
|
|
- path =
|
|
- novfs_dget_path(dentry, buf,
|
|
- PATH_LENGTH_BUFFER);
|
|
+ path = novfs_dget_path(dentry, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- DbgPrint("path %s mode 0%o",
|
|
- path, inode->i_mode);
|
|
+ DbgPrint("path %s mode 0%o", path, inode->i_mode);
|
|
if (IS_ROOT(dentry->d_parent->d_parent)) {
|
|
retCode = novfs_daemon_logout(&dentry->d_name, &session);
|
|
} else {
|
|
- retCode =
|
|
- novfs_delete(path,
|
|
- S_ISDIR(inode->i_mode), session);
|
|
+ retCode = novfs_delete(path, S_ISDIR(inode->i_mode), session);
|
|
if (retCode) {
|
|
struct iattr ia;
|
|
memset(&ia, 0, sizeof(ia));
|
|
@@ -2877,14 +2530,10 @@ int novfs_i_unlink(struct inode *dir, st
|
|
}
|
|
}
|
|
if (!retCode || IS_DEADDIR(inode)) {
|
|
- novfs_remove_inode_entry(dir,
|
|
- &dentry->
|
|
- d_name,
|
|
- 0);
|
|
+ novfs_remove_inode_entry(dir, &dentry->d_name, 0);
|
|
dentry->d_time = 0;
|
|
t64 = 0;
|
|
- novfs_scope_set_userspace(&t64, &t64,
|
|
- &t64, &t64);
|
|
+ novfs_scope_set_userspace(&t64, &t64, &t64, &t64);
|
|
retCode = 0;
|
|
}
|
|
}
|
|
@@ -2907,8 +2556,7 @@ int novfs_i_mkdir(struct inode *dir, str
|
|
uid_t uid;
|
|
|
|
DbgPrint("dir=0x%p ino=%d dentry=0x%p %.*s mode=0%lo",
|
|
- dir, dir->i_ino, dentry, dentry->d_name.len,
|
|
- dentry->d_name.name, mode);
|
|
+ dir, dir->i_ino, dentry, dentry->d_name.len, dentry->d_name.name, mode);
|
|
|
|
if (IS_ROOT(dentry) || /* Root */
|
|
IS_ROOT(dentry->d_parent) || /* User */
|
|
@@ -2920,61 +2568,35 @@ int novfs_i_mkdir(struct inode *dir, str
|
|
mode |= S_IFDIR;
|
|
mode &= (S_IFMT | S_IRWXU);
|
|
if (dir->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) dir->i_private)->Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)dir->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) dir->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) dir->i_private)->
|
|
- Scope);
|
|
+ ((struct inode_data *)dir->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)dir->i_private)->Scope);
|
|
}
|
|
|
|
- uid = novfs_scope_get_uid(((struct inode_data *) dir->i_private)->Scope);
|
|
+ uid = novfs_scope_get_uid(((struct inode_data *)dir->i_private)->Scope);
|
|
buf = kmalloc(PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (buf) {
|
|
path = novfs_dget_path(dentry, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
DbgPrint("path %s", path);
|
|
- retCode =
|
|
- novfs_create(path, S_ISDIR(mode), session);
|
|
+ retCode = novfs_create(path, S_ISDIR(mode), session);
|
|
if (!retCode) {
|
|
- retCode =
|
|
- novfs_get_file_info(path, &info,
|
|
- session);
|
|
+ retCode = novfs_get_file_info(path, &info, session);
|
|
if (!retCode) {
|
|
- retCode =
|
|
- novfs_i_mknod(dir, dentry,
|
|
- mode, 0);
|
|
+ retCode = novfs_i_mknod(dir, dentry, mode, 0);
|
|
inode = dentry->d_inode;
|
|
if (inode) {
|
|
- update_inode(inode,
|
|
- &info);
|
|
- ((struct inode_data *) inode->
|
|
- i_private)->Flags &=
|
|
- ~UPDATE_INODE;
|
|
-
|
|
- dentry->d_time =
|
|
- jiffies +
|
|
- (novfs_update_timeout
|
|
- * HZ);
|
|
-
|
|
- novfs_lock_inode_cache
|
|
- (dir);
|
|
- if (novfs_update_entry
|
|
- (dir,
|
|
- &dentry->d_name, 0,
|
|
- &info)) {
|
|
- novfs_add_inode_entry
|
|
- (dir,
|
|
- &dentry->
|
|
- d_name,
|
|
- inode->
|
|
- i_ino,
|
|
- &info);
|
|
+ update_inode(inode, &info);
|
|
+ ((struct inode_data *)inode->i_private)->Flags &= ~UPDATE_INODE;
|
|
+
|
|
+ dentry->d_time = jiffies + (novfs_update_timeout * HZ);
|
|
+
|
|
+ novfs_lock_inode_cache(dir);
|
|
+ if (novfs_update_entry(dir, &dentry->d_name, 0, &info)) {
|
|
+ novfs_add_inode_entry(dir, &dentry->d_name, inode->i_ino, &info);
|
|
}
|
|
- novfs_unlock_inode_cache
|
|
- (dir);
|
|
+ novfs_unlock_inode_cache(dir);
|
|
}
|
|
|
|
}
|
|
@@ -3006,11 +2628,10 @@ int novfs_i_mknod(struct inode *dir, str
|
|
return (-EACCES);
|
|
}
|
|
|
|
- if (((struct inode_data *) dir->i_private)) {
|
|
- uid = novfs_scope_get_uid(((struct inode_data *) dir->i_private)->Scope);
|
|
+ if (((struct inode_data *)dir->i_private)) {
|
|
+ uid = novfs_scope_get_uid(((struct inode_data *)dir->i_private)->Scope);
|
|
if (mode & (S_IFREG | S_IFDIR)) {
|
|
- inode =
|
|
- novfs_get_inode(dir->i_sb, mode, dev, uid, 0, &dentry->d_name);
|
|
+ inode = novfs_get_inode(dir->i_sb, mode, dev, uid, 0, &dentry->d_name);
|
|
}
|
|
}
|
|
if (inode) {
|
|
@@ -3022,8 +2643,7 @@ int novfs_i_mknod(struct inode *dir, str
|
|
memset(&info, 0, sizeof(info));
|
|
info.mode = inode->i_mode;
|
|
novfs_lock_inode_cache(dir);
|
|
- novfs_add_inode_entry(dir, &dentry->d_name, inode->i_ino,
|
|
- &info);
|
|
+ novfs_add_inode_entry(dir, &dentry->d_name, inode->i_ino, &info);
|
|
novfs_unlock_inode_cache(dir);
|
|
|
|
dput(parent);
|
|
@@ -3034,8 +2654,7 @@ int novfs_i_mknod(struct inode *dir, str
|
|
return retCode;
|
|
}
|
|
|
|
-int novfs_i_rename(struct inode *odir, struct dentry *od, struct inode *ndir,
|
|
- struct dentry *nd)
|
|
+int novfs_i_rename(struct inode *odir, struct dentry *od, struct inode *ndir, struct dentry *nd)
|
|
{
|
|
int retCode = -ENOTEMPTY;
|
|
char *newpath, *newbuf, *newcon;
|
|
@@ -3053,8 +2672,7 @@ int novfs_i_rename(struct inode *odir, s
|
|
return (-EACCES);
|
|
}
|
|
|
|
- DbgPrint("odir=0x%p ino=%d ndir=0x%p ino=%d", odir,
|
|
- odir->i_ino, ndir, ndir->i_ino);
|
|
+ DbgPrint("odir=0x%p ino=%d ndir=0x%p ino=%d", odir, odir->i_ino, ndir, ndir->i_ino);
|
|
|
|
oldbuf = kmalloc(PATH_LENGTH_BUFFER * 2, GFP_KERNEL);
|
|
newbuf = oldbuf + PATH_LENGTH_BUFFER;
|
|
@@ -3065,15 +2683,12 @@ int novfs_i_rename(struct inode *odir, s
|
|
oldlen = PATH_LENGTH_BUFFER - (int)(oldpath - oldbuf);
|
|
newlen = PATH_LENGTH_BUFFER - (int)(newpath - newbuf);
|
|
|
|
- DbgPrint("od=0x%p od->inode=0x%p od->inode->i_ino=%d %s",
|
|
- od, od->d_inode, od->d_inode->i_ino, oldpath);
|
|
+ DbgPrint("od=0x%p od->inode=0x%p od->inode->i_ino=%d %s", od, od->d_inode, od->d_inode->i_ino, oldpath);
|
|
if (nd->d_inode) {
|
|
DbgPrint("nd=0x%p nd->inode=0x%p nd->inode->i_ino=%d %s",
|
|
- nd, nd->d_inode, nd->d_inode->i_ino,
|
|
- newpath);
|
|
+ nd, nd->d_inode, nd->d_inode->i_ino, newpath);
|
|
} else {
|
|
- DbgPrint("nd=0x%p nd->inode=0x%p %s",
|
|
- nd, nd->d_inode, newpath);
|
|
+ DbgPrint("nd=0x%p nd->inode=0x%p %s", nd, nd->d_inode, newpath);
|
|
}
|
|
|
|
/*
|
|
@@ -3084,17 +2699,12 @@ int novfs_i_rename(struct inode *odir, s
|
|
DbgPrint("newcon=0x%p newpath=0x%p", newcon, newpath);
|
|
DbgPrint("oldcon=0x%p oldpath=0x%p", oldcon, oldpath);
|
|
retCode = -EXDEV;
|
|
- if (newcon && oldcon
|
|
- && ((int)(newcon - newpath) ==
|
|
- (int)(oldcon - oldpath))) {
|
|
+ if (newcon && oldcon && ((int)(newcon - newpath) == (int)(oldcon - oldpath))) {
|
|
newcon = strchr(newcon + 1, '\\');
|
|
oldcon = strchr(oldcon + 1, '\\');
|
|
- DbgPrint("2; newcon=0x%p newpath=0x%p",
|
|
- newcon, newpath);
|
|
- DbgPrint("2; oldcon=0x%p oldpath=0x%p",
|
|
- oldcon, oldpath);
|
|
- if (newcon && oldcon &&
|
|
- ((int)(newcon - newpath) == (int)(oldcon - oldpath))) {
|
|
+ DbgPrint("2; newcon=0x%p newpath=0x%p", newcon, newpath);
|
|
+ DbgPrint("2; oldcon=0x%p oldpath=0x%p", oldcon, oldpath);
|
|
+ if (newcon && oldcon && ((int)(newcon - newpath) == (int)(oldcon - oldpath))) {
|
|
newname.name = newpath;
|
|
newname.len = (int)(newcon - newpath);
|
|
newname.hash = 0;
|
|
@@ -3104,23 +2714,18 @@ int novfs_i_rename(struct inode *odir, s
|
|
oldname.hash = 0;
|
|
if (!novfs_d_strcmp(&newname, &oldname)) {
|
|
|
|
- if (od->d_inode
|
|
- && od->d_inode->i_private) {
|
|
+ if (od->d_inode && od->d_inode->i_private) {
|
|
|
|
- if (nd->d_inode
|
|
- && nd->d_inode->
|
|
- i_private) {
|
|
+ if (nd->d_inode && nd->d_inode->i_private) {
|
|
session =
|
|
novfs_scope_get_sessionId
|
|
- (((struct inode_data *) ndir->i_private)->Scope);
|
|
- if (0 ==
|
|
- SC_PRESENT
|
|
- (session)) {
|
|
- ((struct inode_data *) ndir->i_private)->Scope = novfs_get_scope(nd);
|
|
- session
|
|
- =
|
|
- novfs_scope_get_sessionId
|
|
- (((struct inode_data *) ndir->i_private)->Scope);
|
|
+ (((struct inode_data *)ndir->i_private)->Scope);
|
|
+ if (0 == SC_PRESENT(session)) {
|
|
+ ((struct inode_data *)ndir->i_private)->Scope =
|
|
+ novfs_get_scope(nd);
|
|
+ session =
|
|
+ novfs_scope_get_sessionId(((struct inode_data *)ndir->
|
|
+ i_private)->Scope);
|
|
}
|
|
|
|
retCode =
|
|
@@ -3131,20 +2736,28 @@ int novfs_i_rename(struct inode *odir, s
|
|
ia.ia_valid = ATTR_MODE;
|
|
ia.ia_mode = S_IRWXU;
|
|
novfs_set_attr(newpath, &ia, session);
|
|
- retCode = novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode), session);
|
|
+ retCode =
|
|
+ novfs_delete(newpath, S_ISDIR(nd->d_inode->i_mode),
|
|
+ session);
|
|
}
|
|
|
|
}
|
|
|
|
- session = novfs_scope_get_sessionId(((struct inode_data *) ndir->i_private)->Scope);
|
|
+ session =
|
|
+ novfs_scope_get_sessionId(((struct inode_data *)ndir->i_private)->
|
|
+ Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
((struct inode_data *)ndir->i_private)->Scope = novfs_get_scope(nd);
|
|
- session = novfs_scope_get_sessionId(((struct inode_data *) ndir->i_private)->Scope);
|
|
+ session =
|
|
+ novfs_scope_get_sessionId(((struct inode_data *)ndir->
|
|
+ i_private)->Scope);
|
|
}
|
|
- retCode = novfs_rename_file(S_ISDIR(od->d_inode->i_mode), oldpath, oldlen - 1, newpath, newlen - 1, session);
|
|
+ retCode =
|
|
+ novfs_rename_file(S_ISDIR(od->d_inode->i_mode), oldpath, oldlen - 1,
|
|
+ newpath, newlen - 1, session);
|
|
|
|
if (!retCode) {
|
|
- info = (struct novfs_entry_info *) oldbuf;
|
|
+ info = (struct novfs_entry_info *)oldbuf;
|
|
od->d_time = 0;
|
|
novfs_remove_inode_entry(odir, &od->d_name, 0);
|
|
novfs_remove_inode_entry(ndir, &nd->d_name, 0);
|
|
@@ -3152,9 +2765,9 @@ int novfs_i_rename(struct inode *odir, s
|
|
nd->d_time = jiffies + (novfs_update_timeout * HZ);
|
|
|
|
if (od->d_inode && od->d_inode->i_ino) {
|
|
- ino = od->d_inode-> i_ino;
|
|
+ ino = od->d_inode->i_ino;
|
|
} else {
|
|
- ino = (ino_t)atomic_inc_return(&novfs_Inode_Number);
|
|
+ ino = (ino_t) atomic_inc_return(&novfs_Inode_Number);
|
|
}
|
|
novfs_add_inode_entry(ndir, &nd->d_name, ino, info);
|
|
}
|
|
@@ -3172,7 +2785,6 @@ int novfs_i_rename(struct inode *odir, s
|
|
return (retCode);
|
|
}
|
|
|
|
-
|
|
int novfs_i_setattr(struct dentry *dentry, struct iattr *attr)
|
|
{
|
|
char *path, *buf;
|
|
@@ -3192,15 +2804,10 @@ int novfs_i_setattr(struct dentry *dentr
|
|
}
|
|
|
|
if (inode && inode->i_private) {
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->
|
|
- Scope);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
if (0 == SC_PRESENT(session)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- session =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ session = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
}
|
|
|
|
buf = kmalloc(PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
@@ -3211,40 +2818,31 @@ int novfs_i_setattr(struct dentry *dentr
|
|
strcpy(mtime_buf, "Unspecified");
|
|
strcpy(ctime_buf, "Unspecified");
|
|
if (attr->ia_valid & ATTR_ATIME) {
|
|
- ctime_r(&attr->ia_atime.tv_sec,
|
|
- atime_buf);
|
|
+ ctime_r(&attr->ia_atime.tv_sec, atime_buf);
|
|
}
|
|
if (attr->ia_valid & ATTR_MTIME) {
|
|
- ctime_r(&attr->ia_mtime.tv_sec,
|
|
- mtime_buf);
|
|
+ ctime_r(&attr->ia_mtime.tv_sec, mtime_buf);
|
|
}
|
|
if (attr->ia_valid & ATTR_CTIME) {
|
|
- ctime_r(&attr->ia_ctime.tv_sec,
|
|
- ctime_buf);
|
|
+ ctime_r(&attr->ia_ctime.tv_sec, ctime_buf);
|
|
}
|
|
/* Removed for Bug 132374. jlt */
|
|
__DbgPrint("%s: %s\n"
|
|
- " ia_valid: 0x%x\n"
|
|
- " ia_mode: 0%o\n"
|
|
- " ia_uid: %d\n"
|
|
- " ia_gid: %d\n"
|
|
- " ia_size: %lld\n"
|
|
- " ia_atime: %s\n"
|
|
- " ia_mtime: %s\n"
|
|
- " ia_ctime: %s\n", __func__,
|
|
- path,
|
|
- attr->ia_valid,
|
|
- attr->ia_mode,
|
|
- attr->ia_uid,
|
|
- attr->ia_gid,
|
|
- attr->ia_size,
|
|
- atime_buf, mtime_buf, ctime_buf);
|
|
-
|
|
- if (ia_valid
|
|
- && !(retVal =
|
|
- novfs_set_attr(path, attr, session))) {
|
|
- ((struct inode_data *) inode->i_private)->
|
|
- Flags |= UPDATE_INODE;
|
|
+ " ia_valid: 0x%x\n"
|
|
+ " ia_mode: 0%o\n"
|
|
+ " ia_uid: %d\n"
|
|
+ " ia_gid: %d\n"
|
|
+ " ia_size: %lld\n"
|
|
+ " ia_atime: %s\n"
|
|
+ " ia_mtime: %s\n"
|
|
+ " ia_ctime: %s\n", __func__,
|
|
+ path,
|
|
+ attr->ia_valid,
|
|
+ attr->ia_mode,
|
|
+ attr->ia_uid, attr->ia_gid, attr->ia_size, atime_buf, mtime_buf, ctime_buf);
|
|
+
|
|
+ if (ia_valid && !(retVal = novfs_set_attr(path, attr, session))) {
|
|
+ ((struct inode_data *)inode->i_private)->Flags |= UPDATE_INODE;
|
|
|
|
if (ia_valid & ATTR_ATIME)
|
|
inode->i_atime = attr->ia_atime;
|
|
@@ -3253,10 +2851,7 @@ int novfs_i_setattr(struct dentry *dentr
|
|
if (ia_valid & ATTR_CTIME)
|
|
inode->i_ctime = attr->ia_ctime;
|
|
if (ia_valid & ATTR_MODE) {
|
|
- inode->i_mode =
|
|
- attr->
|
|
- ia_mode & (S_IFMT |
|
|
- S_IRWXU);
|
|
+ inode->i_mode = attr->ia_mode & (S_IFMT | S_IRWXU);
|
|
}
|
|
}
|
|
}
|
|
@@ -3268,8 +2863,7 @@ int novfs_i_setattr(struct dentry *dentr
|
|
return (retVal);
|
|
}
|
|
|
|
-int novfs_i_getattr(struct vfsmount *mnt, struct dentry *dentry,
|
|
- struct kstat *kstat)
|
|
+int novfs_i_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat)
|
|
{
|
|
int retCode = 0;
|
|
char atime_buf[32];
|
|
@@ -3296,13 +2890,9 @@ int novfs_i_getattr(struct vfsmount *mnt
|
|
|
|
buf = kmalloc(PATH_LENGTH_BUFFER, GFP_KERNEL);
|
|
if (buf) {
|
|
- path =
|
|
- novfs_dget_path(dentry, buf,
|
|
- PATH_LENGTH_BUFFER);
|
|
+ path = novfs_dget_path(dentry, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- retCode =
|
|
- novfs_get_file_info(path, &info,
|
|
- session);
|
|
+ retCode = novfs_get_file_info(path, &info, session);
|
|
if (!retCode) {
|
|
update_inode(inode, &info);
|
|
id->Flags &= ~UPDATE_INODE;
|
|
@@ -3334,35 +2924,30 @@ int novfs_i_getattr(struct vfsmount *mnt
|
|
ctime_r(&kstat->ctime.tv_sec, ctime_buf);
|
|
|
|
__DbgPrint("%s: 0x%x 0x%p <%.*s>\n"
|
|
- " ino: %d\n"
|
|
- " dev: 0x%x\n"
|
|
- " mode: 0%o\n"
|
|
- " nlink: 0x%x\n"
|
|
- " uid: 0x%x\n"
|
|
- " gid: 0x%x\n"
|
|
- " rdev: 0x%x\n"
|
|
- " size: 0x%llx\n"
|
|
- " atime: %s\n"
|
|
- " mtime: %s\n"
|
|
- " ctime: %s\n"
|
|
- " blksize: 0x%x\n"
|
|
- " blocks: 0x%x\n", __func__,
|
|
- retCode, dentry, dentry->d_name.len, dentry->d_name.name,
|
|
- kstat->ino,
|
|
- kstat->dev,
|
|
- kstat->mode,
|
|
- kstat->nlink,
|
|
- kstat->uid,
|
|
- kstat->gid,
|
|
- kstat->rdev,
|
|
- kstat->size,
|
|
- atime_buf,
|
|
- mtime_buf, ctime_buf, kstat->blksize, kstat->blocks);
|
|
+ " ino: %d\n"
|
|
+ " dev: 0x%x\n"
|
|
+ " mode: 0%o\n"
|
|
+ " nlink: 0x%x\n"
|
|
+ " uid: 0x%x\n"
|
|
+ " gid: 0x%x\n"
|
|
+ " rdev: 0x%x\n"
|
|
+ " size: 0x%llx\n"
|
|
+ " atime: %s\n"
|
|
+ " mtime: %s\n"
|
|
+ " ctime: %s\n"
|
|
+ " blksize: 0x%x\n"
|
|
+ " blocks: 0x%x\n", __func__,
|
|
+ retCode, dentry, dentry->d_name.len, dentry->d_name.name,
|
|
+ kstat->ino,
|
|
+ kstat->dev,
|
|
+ kstat->mode,
|
|
+ kstat->nlink,
|
|
+ kstat->uid,
|
|
+ kstat->gid, kstat->rdev, kstat->size, atime_buf, mtime_buf, ctime_buf, kstat->blksize, kstat->blocks);
|
|
return (retCode);
|
|
}
|
|
|
|
-ssize_t novfs_i_getxattr(struct dentry *dentry, const char *name, void *buffer,
|
|
- size_t buffer_size)
|
|
+ssize_t novfs_i_getxattr(struct dentry * dentry, const char *name, void *buffer, size_t buffer_size)
|
|
{
|
|
struct inode *inode = dentry->d_inode;
|
|
struct novfs_schandle sessionId;
|
|
@@ -3374,23 +2959,17 @@ ssize_t novfs_i_getxattr(struct dentry *
|
|
SC_INITIALIZE(sessionId);
|
|
|
|
DbgPrint("Ian"); /*%.*s\n", dentry->d_name.len, dentry->d_name.name); */
|
|
- DbgPrint("dentry->d_name.len %u, dentry->d_name.name %s",
|
|
- dentry->d_name.len, dentry->d_name.name);
|
|
+ DbgPrint("dentry->d_name.len %u, dentry->d_name.name %s", dentry->d_name.len, dentry->d_name.name);
|
|
DbgPrint("name %s", name);
|
|
DbgPrint("size %u", buffer_size);
|
|
|
|
if (inode && inode->i_private) {
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->
|
|
- Scope);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
DbgPrint("SessionId = %u", sessionId);
|
|
//if (0 == sessionId)
|
|
if (0 == SC_PRESENT(sessionId)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
DbgPrint("SessionId = %u", sessionId);
|
|
}
|
|
}
|
|
@@ -3402,22 +2981,16 @@ ssize_t novfs_i_getxattr(struct dentry *
|
|
if (path) {
|
|
bufRead = kmalloc(XA_BUFFER, GFP_KERNEL);
|
|
if (bufRead) {
|
|
- retxcode =
|
|
- novfs_getx_file_info(path, name, bufRead,
|
|
- XA_BUFFER, &dataLen,
|
|
- sessionId);
|
|
- DbgPrint("after novfs_GetX_File_Info retxcode = %d",
|
|
- retxcode);
|
|
+ retxcode = novfs_getx_file_info(path, name, bufRead, XA_BUFFER, &dataLen, sessionId);
|
|
+ DbgPrint("after novfs_GetX_File_Info retxcode = %d", retxcode);
|
|
if (!retxcode) {
|
|
novfs_dump(64, bufRead);
|
|
if (buffer_size != 0) {
|
|
if (buffer_size >= dataLen) {
|
|
- memcpy(buffer, bufRead,
|
|
- dataLen);
|
|
+ memcpy(buffer, bufRead, dataLen);
|
|
} else {
|
|
DbgPrint("(!!!) not enough buffer_size. buffer_size = %d, dataLen = %d",
|
|
- buffer_size,
|
|
- dataLen);
|
|
+ buffer_size, dataLen);
|
|
retxcode = -ERANGE;
|
|
}
|
|
}
|
|
@@ -3439,8 +3012,7 @@ ssize_t novfs_i_getxattr(struct dentry *
|
|
return (dataLen);
|
|
}
|
|
|
|
-int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value,
|
|
- size_t value_size, int flags)
|
|
+int novfs_i_setxattr(struct dentry *dentry, const char *name, const void *value, size_t value_size, int flags)
|
|
{
|
|
|
|
struct inode *inode = dentry->d_inode;
|
|
@@ -3453,24 +3025,18 @@ int novfs_i_setxattr(struct dentry *dent
|
|
SC_INITIALIZE(sessionId);
|
|
|
|
DbgPrint("Ian"); /*%.*s\n", dentry->d_name.len, dentry->d_name.name); */
|
|
- DbgPrint("dentry->d_name.len %u, dentry->d_name.name %s",
|
|
- dentry->d_name.len, dentry->d_name.name);
|
|
+ DbgPrint("dentry->d_name.len %u, dentry->d_name.name %s", dentry->d_name.len, dentry->d_name.name);
|
|
DbgPrint("name %s", name);
|
|
DbgPrint("value_size %u", value_size);
|
|
DbgPrint("flags %d", flags);
|
|
|
|
if (inode && inode->i_private) {
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->
|
|
- Scope);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
DbgPrint("SessionId = %u", sessionId);
|
|
//if (0 == sessionId)
|
|
if (0 == SC_PRESENT(sessionId)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
DbgPrint("SessionId = %u", sessionId);
|
|
}
|
|
}
|
|
@@ -3479,10 +3045,7 @@ int novfs_i_setxattr(struct dentry *dent
|
|
if (buf) {
|
|
path = novfs_dget_path(dentry, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- retxcode =
|
|
- novfs_setx_file_info(path, name, value, value_size,
|
|
- &bytesWritten, flags,
|
|
- sessionId);
|
|
+ retxcode = novfs_setx_file_info(path, name, value, value_size, &bytesWritten, flags, sessionId);
|
|
if (!retxcode) {
|
|
DbgPrint("bytesWritten = %u", bytesWritten);
|
|
}
|
|
@@ -3500,7 +3063,7 @@ int novfs_i_setxattr(struct dentry *dent
|
|
return (retError);
|
|
}
|
|
|
|
-ssize_t novfs_i_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
|
|
+ssize_t novfs_i_listxattr(struct dentry * dentry, char *buffer, size_t buffer_size)
|
|
{
|
|
struct inode *inode = dentry->d_inode;
|
|
struct novfs_schandle sessionId;
|
|
@@ -3511,22 +3074,16 @@ ssize_t novfs_i_listxattr(struct dentry
|
|
SC_INITIALIZE(sessionId);
|
|
|
|
DbgPrint("Ian"); //%.*s\n", dentry->d_name.len, dentry->d_name.name);
|
|
- DbgPrint("dentry->d_name.len %u, dentry->d_name.name %s",
|
|
- dentry->d_name.len, dentry->d_name.name);
|
|
+ DbgPrint("dentry->d_name.len %u, dentry->d_name.name %s", dentry->d_name.len, dentry->d_name.name);
|
|
DbgPrint("size %u", buffer_size);
|
|
|
|
if (inode && inode->i_private) {
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->i_private)->
|
|
- Scope);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
DbgPrint("SessionId = %u", sessionId);
|
|
//if (0 == sessionId)
|
|
if (0 == SC_PRESENT(sessionId)) {
|
|
- ((struct inode_data *) inode->i_private)->Scope =
|
|
- novfs_get_scope(dentry);
|
|
- sessionId =
|
|
- novfs_scope_get_sessionId(((struct inode_data *) inode->
|
|
- i_private)->Scope);
|
|
+ ((struct inode_data *)inode->i_private)->Scope = novfs_get_scope(dentry);
|
|
+ sessionId = novfs_scope_get_sessionId(((struct inode_data *)inode->i_private)->Scope);
|
|
DbgPrint("SessionId = %u", sessionId);
|
|
}
|
|
}
|
|
@@ -3538,19 +3095,15 @@ ssize_t novfs_i_listxattr(struct dentry
|
|
if (path) {
|
|
bufList = kmalloc(XA_BUFFER, GFP_KERNEL);
|
|
if (bufList) {
|
|
- retxcode =
|
|
- novfs_listx_file_info(path, bufList,
|
|
- XA_BUFFER, &dataLen,
|
|
- sessionId);
|
|
+ retxcode = novfs_listx_file_info(path, bufList, XA_BUFFER, &dataLen, sessionId);
|
|
|
|
novfs_dump(64, bufList);
|
|
if (buffer_size != 0) {
|
|
if (buffer_size >= dataLen) {
|
|
- memcpy(buffer, bufList,
|
|
- dataLen);
|
|
+ memcpy(buffer, bufList, dataLen);
|
|
} else {
|
|
DbgPrint("(!!!) not enough buffer_size. buffer_size = %d, dataLen = %d",
|
|
- buffer_size, dataLen);
|
|
+ buffer_size, dataLen);
|
|
retxcode = -1;
|
|
}
|
|
}
|
|
@@ -3598,8 +3151,7 @@ int novfs_notify_change(struct dentry *d
|
|
struct inode *inode = dentry->d_inode;
|
|
|
|
DbgPrint("Dentry=0x%p Name=%.*s Inode=0x%p Ino=%d ia_valid=0x%x",
|
|
- dentry, dentry->d_name.len, dentry->d_name.name, inode,
|
|
- inode->i_ino, attr->ia_valid);
|
|
+ dentry, dentry->d_name.len, dentry->d_name.name, inode, inode->i_ino, attr->ia_valid);
|
|
return (0);
|
|
}
|
|
|
|
@@ -3610,8 +3162,7 @@ void novfs_clear_inode(struct inode *ino
|
|
if (inode->i_private) {
|
|
struct inode_data *id = inode->i_private;
|
|
|
|
- DbgPrint("inode=0x%p ino=%d Scope=0x%p Name=%s",
|
|
- inode, inode->i_ino, id->Scope, id->Name);
|
|
+ DbgPrint("inode=0x%p ino=%d Scope=0x%p Name=%s", inode, inode->i_ino, id->Scope, id->Name);
|
|
|
|
novfs_free_inode_cache(inode);
|
|
|
|
@@ -3641,17 +3192,12 @@ int novfs_show_options(struct seq_file *
|
|
my_path.dentry = m->mnt_root;
|
|
path = d_path(&my_path, buf, PATH_LENGTH_BUFFER);
|
|
if (path) {
|
|
- if (!novfs_current_mnt
|
|
- || (novfs_current_mnt
|
|
- && strcmp(novfs_current_mnt, path))) {
|
|
+ if (!novfs_current_mnt || (novfs_current_mnt && strcmp(novfs_current_mnt, path))) {
|
|
DbgPrint("%.*s %.*s %s",
|
|
m->mnt_root->d_name.len,
|
|
m->mnt_root->d_name.name,
|
|
- m->mnt_mountpoint->d_name.len,
|
|
- m->mnt_mountpoint->d_name.name, path);
|
|
- tmp = kmalloc(PATH_LENGTH_BUFFER -
|
|
- (int)(path - buf),
|
|
- GFP_KERNEL);
|
|
+ m->mnt_mountpoint->d_name.len, m->mnt_mountpoint->d_name.name, path);
|
|
+ tmp = kmalloc(PATH_LENGTH_BUFFER - (int)(path - buf), GFP_KERNEL);
|
|
if (tmp) {
|
|
strcpy(tmp, path);
|
|
path = novfs_current_mnt;
|
|
@@ -3692,10 +3238,7 @@ int novfs_statfs(struct dentry *de, stru
|
|
buf->f_type = sb->s_magic;
|
|
buf->f_bsize = sb->s_blocksize;
|
|
buf->f_namelen = NW_MAX_PATH_LENGTH;
|
|
- buf->f_blocks =
|
|
- (sector_t) (td +
|
|
- (uint64_t) (sb->s_blocksize -
|
|
- 1)) >> (uint64_t) sb->s_blocksize_bits;
|
|
+ buf->f_blocks = (sector_t) (td + (uint64_t) (sb->s_blocksize - 1)) >> (uint64_t) sb->s_blocksize_bits;
|
|
buf->f_bfree = (sector_t) fd >> (uint64_t) sb->s_blocksize_bits;
|
|
buf->f_bavail = (sector_t) buf->f_bfree;
|
|
buf->f_files = (sector_t) te;
|
|
@@ -3720,8 +3263,7 @@ int novfs_statfs(struct dentry *de, stru
|
|
return 0;
|
|
}
|
|
|
|
-struct inode *novfs_get_inode(struct super_block *sb, int mode, int dev,
|
|
- uid_t Uid, ino_t ino, struct qstr *name)
|
|
+struct inode *novfs_get_inode(struct super_block *sb, int mode, int dev, uid_t Uid, ino_t ino, struct qstr *name)
|
|
{
|
|
struct inode *inode = new_inode(sb);
|
|
|
|
@@ -3733,7 +3275,7 @@ struct inode *novfs_get_inode(struct sup
|
|
inode->i_blkbits = sb->s_blocksize_bits;
|
|
inode->i_blocks = 0;
|
|
inode->i_rdev = 0;
|
|
- inode->i_ino = (ino) ? ino : (ino_t)atomic_inc_return(&novfs_Inode_Number);
|
|
+ inode->i_ino = (ino) ? ino : (ino_t) atomic_inc_return(&novfs_Inode_Number);
|
|
if (novfs_page_cache) {
|
|
inode->i_mapping->a_ops = &novfs_aops;
|
|
} else {
|
|
@@ -3744,13 +3286,9 @@ struct inode *novfs_get_inode(struct sup
|
|
inode->i_atime.tv_nsec = 0;
|
|
inode->i_mtime = inode->i_ctime = inode->i_atime;
|
|
|
|
- DbgPrint("Inode=0x%p I_ino=%d len=%d",
|
|
- inode, inode->i_ino, name->len);
|
|
+ DbgPrint("Inode=0x%p I_ino=%d len=%d", inode, inode->i_ino, name->len);
|
|
|
|
- if (NULL !=
|
|
- (inode->i_private =
|
|
- kmalloc(sizeof(struct inode_data) + name->len,
|
|
- GFP_KERNEL))) {
|
|
+ if (NULL != (inode->i_private = kmalloc(sizeof(struct inode_data) + name->len, GFP_KERNEL))) {
|
|
struct inode_data *id;
|
|
id = inode->i_private;
|
|
|
|
@@ -3863,20 +3401,15 @@ int novfs_fill_super(struct super_block
|
|
inode->i_size = info.size = 0;
|
|
inode->i_uid = info.uid = 0;
|
|
inode->i_gid = info.gid = 0;
|
|
- inode->i_atime = info.atime =
|
|
- inode->i_ctime = info.ctime =
|
|
- inode->i_mtime = info.mtime = CURRENT_TIME;
|
|
+ inode->i_atime = info.atime = inode->i_ctime = info.ctime = inode->i_mtime = info.mtime = CURRENT_TIME;
|
|
|
|
server = d_alloc(novfs_root, &name);
|
|
if (server) {
|
|
server->d_op = &novfs_dentry_operations;
|
|
server->d_time = 0xffffffff;
|
|
d_add(server, inode);
|
|
- DbgPrint("d_add %s 0x%p",
|
|
- SERVER_DIRECTORY_NAME, server);
|
|
- novfs_add_inode_entry(novfs_root->d_inode,
|
|
- &name, inode->i_ino,
|
|
- &info);
|
|
+ DbgPrint("d_add %s 0x%p", SERVER_DIRECTORY_NAME, server);
|
|
+ novfs_add_inode_entry(novfs_root->d_inode, &name, inode->i_ino, &info);
|
|
}
|
|
}
|
|
|
|
@@ -3891,20 +3424,15 @@ int novfs_fill_super(struct super_block
|
|
inode->i_size = info.size = 0;
|
|
inode->i_uid = info.uid = 0;
|
|
inode->i_gid = info.gid = 0;
|
|
- inode->i_atime = info.atime =
|
|
- inode->i_ctime = info.ctime =
|
|
- inode->i_mtime = info.mtime = CURRENT_TIME;
|
|
+ inode->i_atime = info.atime = inode->i_ctime = info.ctime = inode->i_mtime = info.mtime = CURRENT_TIME;
|
|
tree = d_alloc(novfs_root, &name);
|
|
if (tree) {
|
|
tree->d_op = &novfs_dentry_operations;
|
|
tree->d_time = 0xffffffff;
|
|
|
|
d_add(tree, inode);
|
|
- DbgPrint("d_add %s 0x%p",
|
|
- TREE_DIRECTORY_NAME, tree);
|
|
- novfs_add_inode_entry(novfs_root->d_inode,
|
|
- &name, inode->i_ino,
|
|
- &info);
|
|
+ DbgPrint("d_add %s 0x%p", TREE_DIRECTORY_NAME, tree);
|
|
+ novfs_add_inode_entry(novfs_root->d_inode, &name, inode->i_ino, &info);
|
|
}
|
|
}
|
|
}
|
|
@@ -3912,8 +3440,7 @@ int novfs_fill_super(struct super_block
|
|
return (0);
|
|
}
|
|
|
|
-static int novfs_get_sb(struct file_system_type *Fstype, int Flags,
|
|
- const char *Dev_name, void *Data, struct vfsmount *Mnt)
|
|
+static int novfs_get_sb(struct file_system_type *Fstype, int Flags, const char *Dev_name, void *Data, struct vfsmount *Mnt)
|
|
{
|
|
DbgPrint("Fstype=0x%x Dev_name=%s", Fstype, Dev_name);
|
|
return get_sb_nodev(Fstype, Flags, Data, novfs_fill_super, Mnt);
|
|
@@ -3925,8 +3452,7 @@ static void novfs_kill_sb(struct super_b
|
|
kill_litter_super(super);
|
|
}
|
|
|
|
-ssize_t novfs_Control_read(struct file *file, char *buf, size_t nbytes,
|
|
- loff_t * ppos)
|
|
+ssize_t novfs_Control_read(struct file *file, char *buf, size_t nbytes, loff_t * ppos)
|
|
{
|
|
ssize_t retval = 0;
|
|
|
|
@@ -3935,8 +3461,7 @@ ssize_t novfs_Control_read(struct file *
|
|
return retval;
|
|
}
|
|
|
|
-ssize_t novfs_Control_write(struct file * file, const char *buf, size_t nbytes,
|
|
- loff_t * ppos)
|
|
+ssize_t novfs_Control_write(struct file * file, const char *buf, size_t nbytes, loff_t * ppos)
|
|
{
|
|
ssize_t retval = 0;
|
|
|
|
@@ -3947,8 +3472,7 @@ ssize_t novfs_Control_write(struct file
|
|
return (retval);
|
|
}
|
|
|
|
-int novfs_Control_ioctl(struct inode *inode, struct file *file,
|
|
- unsigned int cmd, unsigned long arg)
|
|
+int novfs_Control_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
|
|
{
|
|
int retval = 0;
|
|
|
|
@@ -3976,15 +3500,13 @@ int __init init_novfs(void)
|
|
|
|
retCode = bdi_init(&novfs_backing_dev_info);
|
|
|
|
- if(!retCode)
|
|
+ if (!retCode)
|
|
retCode = bdi_register(&novfs_backing_dev_info, NULL, "novfs-map");
|
|
if (retCode) {
|
|
bdi_destroy(&novfs_backing_dev_info);
|
|
goto bdi_fail;
|
|
}
|
|
|
|
-
|
|
-
|
|
retCode = novfs_proc_init();
|
|
|
|
novfs_profile_init();
|
|
@@ -4044,8 +3566,7 @@ void novfs_unlock_inode_cache(struct ino
|
|
}
|
|
}
|
|
|
|
-int novfs_enumerate_inode_cache(struct inode *i, struct list_head **iteration,
|
|
- ino_t * ino, struct novfs_entry_info *info)
|
|
+int novfs_enumerate_inode_cache(struct inode *i, struct list_head **iteration, ino_t * ino, struct novfs_entry_info *info)
|
|
/*
|
|
* Arguments: struct inode *i - pointer to directory inode
|
|
*
|
|
@@ -4094,8 +3615,7 @@ int novfs_enumerate_inode_cache(struct i
|
|
}
|
|
|
|
/* DirCacheLock should be held before calling this routine. */
|
|
-int novfs_get_entry(struct inode *i, struct qstr *name, ino_t * ino,
|
|
- struct novfs_entry_info *info)
|
|
+int novfs_get_entry(struct inode *i, struct qstr *name, ino_t * ino, struct novfs_entry_info *info)
|
|
{
|
|
struct inode_data *id;
|
|
struct novfs_dir_cache *dc;
|
|
@@ -4133,8 +3653,7 @@ int novfs_get_entry(struct inode *i, str
|
|
}
|
|
|
|
/*DirCacheLock should be held before calling this routine. */
|
|
-int novfs_get_entry_by_pos(struct inode *i, loff_t pos, ino_t * ino,
|
|
- struct novfs_entry_info *info)
|
|
+int novfs_get_entry_by_pos(struct inode *i, loff_t pos, ino_t * ino, struct novfs_entry_info *info)
|
|
{
|
|
int retVal = -1;
|
|
loff_t count = 0;
|
|
@@ -4153,8 +3672,7 @@ int novfs_get_entry_by_pos(struct inode
|
|
}
|
|
|
|
/* DirCacheLock should be held before calling this routine. */
|
|
-int novfs_get_entry_time(struct inode *i, struct qstr *name, ino_t * ino,
|
|
- struct novfs_entry_info *info, u64 * EntryTime)
|
|
+int novfs_get_entry_time(struct inode *i, struct qstr *name, ino_t * ino, struct novfs_entry_info *info, u64 * EntryTime)
|
|
{
|
|
struct inode_data *id;
|
|
struct novfs_dir_cache *dc;
|
|
@@ -4255,8 +3773,7 @@ void novfs_invalidate_inode_cache(struct
|
|
}
|
|
|
|
/*++======================================================================*/
|
|
-struct novfs_dir_cache *novfs_lookup_inode_cache(struct inode *i, struct qstr *name,
|
|
- ino_t ino)
|
|
+struct novfs_dir_cache *novfs_lookup_inode_cache(struct inode *i, struct qstr *name, ino_t ino)
|
|
/*
|
|
* Returns: struct novfs_dir_cache entry if match
|
|
* NULL - if there is no match.
|
|
@@ -4282,8 +3799,7 @@ struct novfs_dir_cache *novfs_lookup_ino
|
|
n = (char *)name->name;
|
|
hash = name->hash;
|
|
}
|
|
- DbgPrint("inode: 0x%p; name: %.*s; hash: 0x%x;\n"
|
|
- " len: %d; ino: %d", i, nl, n, hash, nl, ino);
|
|
+ DbgPrint("inode: 0x%p; name: %.*s; hash: 0x%x;\n" " len: %d; ino: %d", i, nl, n, hash, nl, ino);
|
|
|
|
list_for_each(l, &id->DirCache) {
|
|
dc = list_entry(l, struct novfs_dir_cache, list);
|
|
@@ -4297,9 +3813,7 @@ struct novfs_dir_cache *novfs_lookup_ino
|
|
dc, dc->ino, dc->hash, dc->nameLen, dc->nameLen, dc->name);
|
|
*/
|
|
if ((name->hash == dc->hash) &&
|
|
- (name->len == dc->nameLen) &&
|
|
- (0 ==
|
|
- memcmp(name->name, dc->name, name->len))) {
|
|
+ (name->len == dc->nameLen) && (0 == memcmp(name->name, dc->name, name->len))) {
|
|
retVal = dc;
|
|
break;
|
|
}
|
|
@@ -4351,8 +3865,7 @@ int novfs_lookup_validate(struct inode *
|
|
*
|
|
* DirCacheLock should be held before calling this routine.
|
|
*/
|
|
-int novfs_add_inode_entry(struct inode *i,
|
|
- struct qstr *name, ino_t ino, struct novfs_entry_info *info)
|
|
+int novfs_add_inode_entry(struct inode *i, struct qstr *name, ino_t ino, struct novfs_entry_info *info)
|
|
{
|
|
struct inode_data *id;
|
|
struct novfs_dir_cache *new;
|
|
@@ -4375,8 +3888,7 @@ int novfs_add_inode_entry(struct inode *
|
|
DCCount++;
|
|
DbgPrint("inode: 0x%p; id: 0x%p; DC: 0x%p; new: 0x%p; "
|
|
"name: %.*s; ino: %d; size: %lld; mode: 0x%x",
|
|
- i, id, &id->DirCache, new, name->len,
|
|
- name->name, ino, info->size, info->mode);
|
|
+ i, id, &id->DirCache, new, name->len, name->name, ino, info->size, info->mode);
|
|
|
|
retVal = 0;
|
|
new->flags = ENTRY_VALID;
|
|
@@ -4400,8 +3912,7 @@ int novfs_add_inode_entry(struct inode *
|
|
/*
|
|
* DirCacheLock should be held before calling this routine.
|
|
*/
|
|
-int novfs_update_entry(struct inode *i, struct qstr *name, ino_t ino,
|
|
- struct novfs_entry_info *info)
|
|
+int novfs_update_entry(struct inode *i, struct qstr *name, ino_t ino, struct novfs_entry_info *info)
|
|
{
|
|
struct inode_data *id;
|
|
struct novfs_dir_cache *dc;
|
|
@@ -4422,9 +3933,7 @@ int novfs_update_entry(struct inode *i,
|
|
ctime_r(&info->mtime.tv_sec, mtime_buf);
|
|
ctime_r(&info->ctime.tv_sec, ctime_buf);
|
|
DbgPrint("inode: 0x%p; name: %.*s; ino: %d; size: %lld; "
|
|
- "atime: %s; mtime: %s; ctime: %s",
|
|
- i, nl, n, ino, info->size, atime_buf, mtime_buf,
|
|
- ctime_buf);
|
|
+ "atime: %s; mtime: %s; ctime: %s", i, nl, n, ino, info->size, atime_buf, mtime_buf, ctime_buf);
|
|
|
|
dc = novfs_lookup_inode_cache(i, name, ino);
|
|
if (dc) {
|
|
@@ -4445,9 +3954,7 @@ int novfs_update_entry(struct inode *i,
|
|
"mtime: %s %d; ctime: %s; hash: 0x%x; "
|
|
" nameLen: %d; name: %s",
|
|
dc, dc->flags, dc->jiffies, dc->ino, dc->size,
|
|
- dc->mode, atime_buf, mtime_buf,
|
|
- dc->mtime.tv_nsec, ctime_buf, dc->hash,
|
|
- dc->nameLen, dc->name);
|
|
+ dc->mode, atime_buf, mtime_buf, dc->mtime.tv_nsec, ctime_buf, dc->hash, dc->nameLen, dc->name);
|
|
}
|
|
}
|
|
DbgPrint("return %d", retVal);
|
|
@@ -4479,8 +3986,7 @@ void novfs_remove_inode_entry(struct ino
|
|
"[name: %.*s; ino: %d; next: 0x%p; "
|
|
"prev: 0x%p]",
|
|
i, id, &id->DirCache, nl, n, ino, dc,
|
|
- dc->nameLen, dc->name, dc->ino, dc->list.next,
|
|
- dc->list.prev);
|
|
+ dc->nameLen, dc->name, dc->ino, dc->list.next, dc->list.prev);
|
|
list_del(&dc->list);
|
|
kfree(dc);
|
|
DCCount--;
|
|
@@ -4506,9 +4012,7 @@ void novfs_free_invalid_entries(struct i
|
|
dc = list_entry(l, struct novfs_dir_cache, list);
|
|
if (0 == (dc->flags & ENTRY_VALID)) {
|
|
DbgPrint("inode: 0x%p; id: 0x%p; entry: 0x%p; "
|
|
- "name: %.*s; ino: %d",
|
|
- i, id, dc, dc->nameLen, dc->name,
|
|
- dc->ino);
|
|
+ "name: %.*s; ino: %d", i, id, dc, dc->nameLen, dc->name, dc->ino);
|
|
l = l->prev;
|
|
list_del(&dc->list);
|
|
kfree(dc);
|
|
@@ -4565,25 +4069,20 @@ void novfs_dump_inode(void *pf)
|
|
|
|
pfunc("Inode=0x%p I_ino=%d\n", inode, inode->i_ino);
|
|
|
|
- pfunc(" atime=%s\n",
|
|
- ctime_r(&inode->i_atime.tv_sec, atime_buf));
|
|
- pfunc(" ctime=%s\n",
|
|
- ctime_r(&inode->i_mtime.tv_sec, atime_buf));
|
|
- pfunc(" mtime=%s\n",
|
|
- ctime_r(&inode->i_ctime.tv_sec, atime_buf));
|
|
+ pfunc(" atime=%s\n", ctime_r(&inode->i_atime.tv_sec, atime_buf));
|
|
+ pfunc(" ctime=%s\n", ctime_r(&inode->i_mtime.tv_sec, atime_buf));
|
|
+ pfunc(" mtime=%s\n", ctime_r(&inode->i_ctime.tv_sec, atime_buf));
|
|
pfunc(" size=%lld\n", inode->i_size);
|
|
pfunc(" mode=0%o\n", inode->i_mode);
|
|
pfunc(" count=0%o\n", atomic_read(&inode->i_count));
|
|
}
|
|
|
|
- pfunc(" nofs_inode_data: 0x%p Name=%s Scope=0x%p\n", id, id->Name,
|
|
- id->Scope);
|
|
+ pfunc(" nofs_inode_data: 0x%p Name=%s Scope=0x%p\n", id, id->Name, id->Scope);
|
|
|
|
if (id->DirCache.next) {
|
|
list_for_each(l, &id->DirCache) {
|
|
dccnt++;
|
|
- dc = list_entry(l, struct novfs_dir_cache,
|
|
- list);
|
|
+ dc = list_entry(l, struct novfs_dir_cache, list);
|
|
ctime_r(&dc->atime.tv_sec, atime_buf);
|
|
ctime_r(&dc->mtime.tv_sec, mtime_buf);
|
|
ctime_r(&dc->ctime.tv_sec, ctime_buf);
|
|
@@ -4602,15 +4101,13 @@ void novfs_dump_inode(void *pf)
|
|
" name: %s\n",
|
|
dc, dc->flags, dc->jiffies,
|
|
dc->ino, dc->size, dc->mode,
|
|
- atime_buf, mtime_buf, ctime_buf,
|
|
- dc->hash, dc->nameLen, dc->name);
|
|
+ atime_buf, mtime_buf, ctime_buf, dc->hash, dc->nameLen, dc->name);
|
|
}
|
|
}
|
|
}
|
|
up(&InodeList_lock);
|
|
|
|
- pfunc("Inodes: %d(%d) DirCache: %d(%d)\n", InodeCount, icnt, DCCount,
|
|
- dccnt);
|
|
+ pfunc("Inodes: %d(%d) DirCache: %d(%d)\n", InodeCount, icnt, DCCount, dccnt);
|
|
|
|
}
|
|
|
|
--- a/fs/novfs/nwcapi.c
|
|
+++ b/fs/novfs/nwcapi.c
|
|
@@ -31,11 +31,13 @@
|
|
#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
|
|
#endif
|
|
|
|
-static void GetUserData(struct nwc_scan_conn_info * connInfo, struct novfs_xplat_call_request *cmd, struct novfs_xplat_call_reply *reply);
|
|
-static void GetConnData(struct nwc_get_conn_info * connInfo, struct novfs_xplat_call_request *cmd, struct novfs_xplat_call_reply *reply);
|
|
+static void GetUserData(struct nwc_scan_conn_info *connInfo, struct novfs_xplat_call_request *cmd,
|
|
+ struct novfs_xplat_call_reply *reply);
|
|
+static void GetConnData(struct nwc_get_conn_info *connInfo, struct novfs_xplat_call_request *cmd,
|
|
+ struct novfs_xplat_call_reply *reply);
|
|
|
|
/*++======================================================================*/
|
|
-int novfs_open_conn_by_name(struct novfs_xplat *pdata, void ** Handle, struct novfs_schandle Session)
|
|
+int novfs_open_conn_by_name(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
@@ -63,7 +65,7 @@ int novfs_open_conn_by_name(struct novfs
|
|
cmd->NwcCommand = NWC_OPEN_CONN_BY_NAME;
|
|
|
|
cmd->dataLen = datalen;
|
|
- openConn = (struct nwd_open_conn_by_name *) cmd->data;
|
|
+ openConn = (struct nwd_open_conn_by_name *)cmd->data;
|
|
|
|
openConn->nameLen = pnamelen;
|
|
openConn->serviceLen = stypelen;
|
|
@@ -78,21 +80,18 @@ int novfs_open_conn_by_name(struct novfs
|
|
data += openConn->nameLen;
|
|
cpylen = copy_from_user(data, ocbn.pServiceType, openConn->serviceLen);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
/*
|
|
* we got reply data from the daemon
|
|
*/
|
|
- connReply = (struct nwd_open_conn_by_name *) reply->data;
|
|
+ connReply = (struct nwd_open_conn_by_name *)reply->data;
|
|
retCode = reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
/*
|
|
* we got valid data.
|
|
*/
|
|
- connReply = (struct nwd_open_conn_by_name *) reply->data;
|
|
+ connReply = (struct nwd_open_conn_by_name *)reply->data;
|
|
ocbn.RetConnHandle = HandletoUint32(connReply->newConnHandle);
|
|
*Handle = connReply->newConnHandle;
|
|
|
|
@@ -107,7 +106,7 @@ int novfs_open_conn_by_name(struct novfs
|
|
|
|
}
|
|
|
|
-int novfs_open_conn_by_addr(struct novfs_xplat *pdata, void ** Handle, struct novfs_schandle Session)
|
|
+int novfs_open_conn_by_addr(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
@@ -131,7 +130,7 @@ int novfs_open_conn_by_addr(struct novfs
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_OPEN_CONN_BY_ADDRESS;
|
|
cmd->dataLen = datalen;
|
|
- openConn = (struct nwd_open_conn_by_addr *) cmd->data;
|
|
+ openConn = (struct nwd_open_conn_by_addr *)cmd->data;
|
|
|
|
cpylen = copy_from_user(&tranAddr, ocba.pTranAddr, sizeof(tranAddr));
|
|
if (tranAddr.uAddressLength > sizeof(addr)) {
|
|
@@ -151,28 +150,23 @@ int novfs_open_conn_by_addr(struct novfs
|
|
DbgPrint("addr");
|
|
novfs_dump(sizeof(addr), addr);
|
|
|
|
- openConn->TranAddr.oAddress = *(unsigned int *) (&addr[2]);
|
|
+ openConn->TranAddr.oAddress = *(unsigned int *)(&addr[2]);
|
|
|
|
- retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
/*
|
|
* we got reply data from the daemon
|
|
*/
|
|
- connReply = (struct nwd_open_conn_by_addr *) reply->data;
|
|
+ connReply = (struct nwd_open_conn_by_addr *)reply->data;
|
|
retCode = reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
/*
|
|
* we got valid data.
|
|
*/
|
|
- connReply = (struct nwd_open_conn_by_addr *) reply->data;
|
|
- ocba.ConnHandle =
|
|
- HandletoUint32(connReply->ConnHandle);
|
|
+ connReply = (struct nwd_open_conn_by_addr *)reply->data;
|
|
+ ocba.ConnHandle = HandletoUint32(connReply->ConnHandle);
|
|
*Handle = connReply->ConnHandle;
|
|
- cpylen =
|
|
- copy_to_user(pdata->reqData, &ocba,
|
|
- sizeof(ocba));
|
|
+ cpylen = copy_to_user(pdata->reqData, &ocba, sizeof(ocba));
|
|
DbgPrint("New Conn Handle = %X", connReply->ConnHandle);
|
|
}
|
|
kfree(reply);
|
|
@@ -184,7 +178,7 @@ out:
|
|
|
|
}
|
|
|
|
-int novfs_open_conn_by_ref(struct novfs_xplat *pdata, void ** Handle, struct novfs_schandle Session)
|
|
+int novfs_open_conn_by_ref(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
@@ -205,20 +199,17 @@ int novfs_open_conn_by_ref(struct novfs_
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_OPEN_CONN_BY_REFERENCE;
|
|
cmd->dataLen = datalen;
|
|
- openConn = (struct nwd_open_conn_by_ref *) cmd->data;
|
|
+ openConn = (struct nwd_open_conn_by_ref *)cmd->data;
|
|
|
|
- openConn->uConnReference = (void *) (unsigned long) ocbr.uConnReference;
|
|
+ openConn->uConnReference = (void *)(unsigned long)ocbr.uConnReference;
|
|
openConn->uConnFlags = ocbr.uConnFlags;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
/*
|
|
* we got reply data from the daemon
|
|
*/
|
|
- openConn = (struct nwd_open_conn_by_ref *) reply->data;
|
|
+ openConn = (struct nwd_open_conn_by_ref *)reply->data;
|
|
retCode = reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
/*
|
|
@@ -306,8 +297,7 @@ int novfs_raw_send(struct novfs_xplat *p
|
|
* Allocate the cmd Request
|
|
*/
|
|
cmdlen = datalen + sizeof(*cmd) + sizeof(*ncpData);
|
|
- DbgPrint("[XPLAT RawNCP] - Frag Count 0x%X",
|
|
- xRequest.uNumRequestFrags);
|
|
+ DbgPrint("[XPLAT RawNCP] - Frag Count 0x%X", xRequest.uNumRequestFrags);
|
|
DbgPrint("[XPLAT RawNCP] - Total Command Data Len = %x", cmdlen);
|
|
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
@@ -325,10 +315,10 @@ int novfs_raw_send(struct novfs_xplat *p
|
|
* build the NCP Request
|
|
*/
|
|
cmd->dataLen = cmdlen - sizeof(*cmd);
|
|
- ncpData = (struct nwd_ncp_req *) cmd->data;
|
|
+ ncpData = (struct nwd_ncp_req *)cmd->data;
|
|
ncpData->replyLen = totalLen;
|
|
ncpData->requestLen = datalen;
|
|
- ncpData->ConnHandle = (void *) (unsigned long) xRequest.ConnHandle;
|
|
+ ncpData->ConnHandle = (void *)(unsigned long)xRequest.ConnHandle;
|
|
ncpData->function = xRequest.uFunction;
|
|
|
|
reqData = ncpData->data;
|
|
@@ -340,10 +330,7 @@ int novfs_raw_send(struct novfs_xplat *p
|
|
cFrag++;
|
|
}
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
DbgPrint("RawNCP - reply = %x", reply);
|
|
DbgPrint("RawNCP - retCode = %x", retCode);
|
|
|
|
@@ -351,11 +338,10 @@ int novfs_raw_send(struct novfs_xplat *p
|
|
/*
|
|
* we got reply data from the daemon
|
|
*/
|
|
- ncpReply = (struct nwd_ncp_rep *) reply->data;
|
|
+ ncpReply = (struct nwd_ncp_rep *)reply->data;
|
|
retCode = reply->Reply.ErrorCode;
|
|
|
|
- DbgPrint("RawNCP - Reply Frag Count 0x%X",
|
|
- xRequest.uNumReplyFrags);
|
|
+ DbgPrint("RawNCP - Reply Frag Count 0x%X", xRequest.uNumReplyFrags);
|
|
|
|
/*
|
|
* We need to copy the reply frags to the packet.
|
|
@@ -366,10 +352,9 @@ int novfs_raw_send(struct novfs_xplat *p
|
|
totalLen = ncpReply->replyLen;
|
|
for (x = 0; x < xRequest.uNumReplyFrags; x++) {
|
|
|
|
- DbgPrint("RawNCP - Copy Frag %d: 0x%X", x,
|
|
- cFrag->uLength);
|
|
+ DbgPrint("RawNCP - Copy Frag %d: 0x%X", x, cFrag->uLength);
|
|
|
|
- datalen = min((unsigned long) cFrag->uLength, totalLen);
|
|
+ datalen = min((unsigned long)cFrag->uLength, totalLen);
|
|
|
|
cpylen = copy_to_user(cFrag->pData, reqData, datalen);
|
|
totalLen -= datalen;
|
|
@@ -384,7 +369,6 @@ int novfs_raw_send(struct novfs_xplat *p
|
|
retCode = -EIO;
|
|
}
|
|
|
|
-
|
|
xRequest.uActualReplyLength = actualReplyLength;
|
|
cpylen = copy_to_user(pdata->reqData, &xRequest, sizeof(xRequest));
|
|
|
|
@@ -396,7 +380,7 @@ out:
|
|
return (retCode);
|
|
}
|
|
|
|
-int novfs_conn_close(struct novfs_xplat *pdata, void ** Handle, struct novfs_schandle Session)
|
|
+int novfs_conn_close(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
@@ -417,16 +401,14 @@ int novfs_conn_close(struct novfs_xplat
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_CLOSE_CONN;
|
|
|
|
- nwdClose = (struct nwd_close_conn *) cmd->data;
|
|
+ nwdClose = (struct nwd_close_conn *)cmd->data;
|
|
cmd->dataLen = sizeof(*nwdClose);
|
|
*Handle = nwdClose->ConnHandle = Uint32toHandle(cc.ConnHandle);
|
|
|
|
/*
|
|
* send the request
|
|
*/
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen, 0);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, 0);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -457,16 +439,15 @@ int novfs_sys_conn_close(struct novfs_xp
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_SYS_CLOSE_CONN;
|
|
|
|
- nwdClose = (struct nwd_close_conn *) cmd->data;
|
|
+ nwdClose = (struct nwd_close_conn *)cmd->data;
|
|
cmd->dataLen = sizeof(*nwdClose);
|
|
- nwdClose->ConnHandle = (void *) (unsigned long) cc.ConnHandle;
|
|
- *Handle = (unsigned long) cc.ConnHandle;
|
|
+ nwdClose->ConnHandle = (void *)(unsigned long)cc.ConnHandle;
|
|
+ *Handle = (unsigned long)cc.ConnHandle;
|
|
|
|
/*
|
|
* send the request
|
|
*/
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, 0);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, 0);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -486,7 +467,6 @@ int novfs_login_id(struct novfs_xplat *p
|
|
unsigned long cpylen;
|
|
struct nwc_string nwcStr;
|
|
|
|
-
|
|
memset(&server, 0, sizeof(server));
|
|
memset(&username, 0, sizeof(username));
|
|
memset(&password, 0, sizeof(password));
|
|
@@ -536,13 +516,17 @@ int novfs_login_id(struct novfs_xplat *p
|
|
password.type = nwcStr.DataType;
|
|
password.len = nwcStr.DataLen;
|
|
if (!copy_from_user((void *)password.buffer, nwcStr.pBuffer, password.len)) {
|
|
- retCode = novfs_do_login(&server, &username, &password, (void **)&lgn.AuthenticationId, &Session);
|
|
+ retCode =
|
|
+ novfs_do_login(&server, &username, &password,
|
|
+ (void **)&lgn.AuthenticationId, &Session);
|
|
if (retCode) {
|
|
lgn.AuthenticationId = 0;
|
|
}
|
|
|
|
plgn = (struct nwc_login_id *)pdata->reqData;
|
|
- cpylen = copy_to_user(&plgn->AuthenticationId, &lgn.AuthenticationId, sizeof(plgn->AuthenticationId));
|
|
+ cpylen =
|
|
+ copy_to_user(&plgn->AuthenticationId, &lgn.AuthenticationId,
|
|
+ sizeof(plgn->AuthenticationId));
|
|
}
|
|
memset(password.buffer, 0, password.len);
|
|
|
|
@@ -581,15 +565,12 @@ int novfs_auth_conn(struct novfs_xplat *
|
|
|
|
cpylen = copy_from_user(&pauth, pdata->reqData, sizeof(pauth));
|
|
|
|
- pDauth = (struct nwc_auth_wid *) cmd->data;
|
|
+ pDauth = (struct nwc_auth_wid *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
pDauth->AuthenticationId = pauth.AuthenticationId;
|
|
- pDauth->ConnHandle = (void *) (unsigned long) pauth.ConnHandle;
|
|
+ pDauth->ConnHandle = (void *)(unsigned long)pauth.ConnHandle;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -602,7 +583,7 @@ int novfs_license_conn(struct novfs_xpla
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
struct nwc_license_conn lisc;
|
|
- struct nwc_lisc_id * pDLisc = NULL;
|
|
+ struct nwc_lisc_id *pDLisc = NULL;
|
|
int retCode = -ENOMEM;
|
|
unsigned long cmdlen, datalen, replylen, cpylen;
|
|
|
|
@@ -619,14 +600,11 @@ int novfs_license_conn(struct novfs_xpla
|
|
|
|
cpylen = copy_from_user(&lisc, pdata->reqData, sizeof(lisc));
|
|
|
|
- pDLisc = (struct nwc_lisc_id *) cmd->data;
|
|
+ pDLisc = (struct nwc_lisc_id *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
- pDLisc->ConnHandle = (void *) (unsigned long) lisc.ConnHandle;
|
|
+ pDLisc->ConnHandle = (void *)(unsigned long)lisc.ConnHandle;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -654,17 +632,13 @@ int novfs_logout_id(struct novfs_xplat *
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_LOGOUT_IDENTITY;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&logout, pdata->reqData, sizeof(logout));
|
|
+ cpylen = copy_from_user(&logout, pdata->reqData, sizeof(logout));
|
|
|
|
- pDLogout = (struct nwc_lo_id *) cmd->data;
|
|
+ pDLogout = (struct nwc_lo_id *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
pDLogout->AuthenticationId = logout.AuthenticationId;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -693,13 +667,10 @@ int novfs_unlicense_conn(struct novfs_xp
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_UNLICENSE_CONN;
|
|
cmd->dataLen = datalen;
|
|
- pUconn = (struct nwc_unlic_conn *) cmd->data;
|
|
+ pUconn = (struct nwc_unlic_conn *)cmd->data;
|
|
|
|
- pUconn->ConnHandle = (void *) (unsigned long) ulc.ConnHandle;
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ pUconn->ConnHandle = (void *)(unsigned long)ulc.ConnHandle;
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
/*
|
|
* we got reply data from the daemon
|
|
@@ -732,15 +703,12 @@ int novfs_unauthenticate(struct novfs_xp
|
|
|
|
cpylen = copy_from_user(&auth, pdata->reqData, sizeof(auth));
|
|
|
|
- pDAuth = (struct nwc_unauthenticate *) cmd->data;
|
|
+ pDAuth = (struct nwc_unauthenticate *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
pDAuth->AuthenticationId = auth.AuthenticationId;
|
|
- pDAuth->ConnHandle = (void *) (unsigned long) auth.ConnHandle;
|
|
+ pDAuth->ConnHandle = (void *)(unsigned long)auth.ConnHandle;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -761,8 +729,7 @@ int novfs_get_conn_info(struct novfs_xpl
|
|
|
|
cmdlen = sizeof(*cmd) + sizeof(*pDConnInfo);
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
- cpylen =
|
|
- copy_from_user(&connInfo, pdata->reqData, sizeof(struct nwc_get_conn_info));
|
|
+ cpylen = copy_from_user(&connInfo, pdata->reqData, sizeof(struct nwc_get_conn_info));
|
|
|
|
if (!cmd)
|
|
return -ENOMEM;
|
|
@@ -777,17 +744,14 @@ int novfs_get_conn_info(struct novfs_xpl
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_GET_CONN_INFO;
|
|
|
|
- pDConnInfo = (struct nwd_conn_info *) cmd->data;
|
|
+ pDConnInfo = (struct nwd_conn_info *)cmd->data;
|
|
|
|
- pDConnInfo->ConnHandle = (void *) (unsigned long) connInfo.ConnHandle;
|
|
+ pDConnInfo->ConnHandle = (void *)(unsigned long)connInfo.ConnHandle;
|
|
pDConnInfo->uInfoLevel = connInfo.uInfoLevel;
|
|
pDConnInfo->uInfoLength = connInfo.uInfoLength;
|
|
cmd->dataLen = sizeof(*pDConnInfo);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
@@ -827,17 +791,14 @@ int novfs_set_conn_info(struct novfs_xpl
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_SET_CONN_INFO;
|
|
|
|
- pDConnInfo = (struct nwd_set_conn_info *) cmd->data;
|
|
+ pDConnInfo = (struct nwd_set_conn_info *)cmd->data;
|
|
|
|
- pDConnInfo->ConnHandle = (void *) (unsigned long) connInfo.ConnHandle;
|
|
+ pDConnInfo->ConnHandle = (void *)(unsigned long)connInfo.ConnHandle;
|
|
pDConnInfo->uInfoLevel = connInfo.uInfoLevel;
|
|
pDConnInfo->uInfoLength = connInfo.uInfoLength;
|
|
cmd->dataLen = sizeof(*pDConnInfo);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -872,13 +833,11 @@ int novfs_get_id_info(struct novfs_xplat
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_GET_IDENTITY_INFO;
|
|
|
|
- idInfo = (struct nwd_get_id_info *) cmd->data;
|
|
+ idInfo = (struct nwd_get_id_info *)cmd->data;
|
|
idInfo->AuthenticationId = qidInfo.AuthenticationId;
|
|
cmd->dataLen = sizeof(*idInfo);
|
|
|
|
- retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
|
|
@@ -887,32 +846,20 @@ int novfs_get_id_info(struct novfs_xplat
|
|
* Save the return info to the user structure.
|
|
*/
|
|
gId = pdata->reqData;
|
|
- idInfo = (struct nwd_get_id_info *) reply->data;
|
|
- cpylen = copy_to_user(&gId->AuthenticationId,
|
|
- &idInfo->AuthenticationId,
|
|
- sizeof(idInfo->
|
|
- AuthenticationId));
|
|
- cpylen = copy_to_user(&gId->AuthType,
|
|
- &idInfo->AuthType,
|
|
- sizeof(idInfo->AuthType));
|
|
- cpylen = copy_to_user(&gId->IdentityFlags,
|
|
- &idInfo->IdentityFlags,
|
|
- sizeof(idInfo->IdentityFlags));
|
|
- cpylen = copy_to_user(&gId->NameType,
|
|
- &idInfo->NameType,
|
|
- sizeof(idInfo->NameType));
|
|
- cpylen = copy_to_user(&gId->ObjectType,
|
|
- &idInfo->ObjectType,
|
|
- sizeof(idInfo->ObjectType));
|
|
+ idInfo = (struct nwd_get_id_info *)reply->data;
|
|
+ cpylen = copy_to_user(&gId->AuthenticationId, &idInfo->AuthenticationId, sizeof(idInfo->AuthenticationId));
|
|
+ cpylen = copy_to_user(&gId->AuthType, &idInfo->AuthType, sizeof(idInfo->AuthType));
|
|
+ cpylen = copy_to_user(&gId->IdentityFlags, &idInfo->IdentityFlags, sizeof(idInfo->IdentityFlags));
|
|
+ cpylen = copy_to_user(&gId->NameType, &idInfo->NameType, sizeof(idInfo->NameType));
|
|
+ cpylen = copy_to_user(&gId->ObjectType, &idInfo->ObjectType, sizeof(idInfo->ObjectType));
|
|
|
|
- cpylen = copy_from_user(&xferStr, gId->pDomainName,
|
|
- sizeof(struct nwc_string));
|
|
+ cpylen = copy_from_user(&xferStr, gId->pDomainName, sizeof(struct nwc_string));
|
|
if (idInfo->pDomainNameOffset >= reply->dataLen) {
|
|
retCode = -EINVAL;
|
|
goto out;
|
|
}
|
|
str = (char *)((char *)reply->data + idInfo->pDomainNameOffset);
|
|
- if (idInfo->domainLen > reply->dataLen - idInfo->pDomainNameOffset ) {
|
|
+ if (idInfo->domainLen > reply->dataLen - idInfo->pDomainNameOffset) {
|
|
retCode = -EINVAL;
|
|
goto out;
|
|
}
|
|
@@ -937,10 +884,10 @@ int novfs_get_id_info(struct novfs_xplat
|
|
xferStr.DataType = NWC_STRING_TYPE_ASCII;
|
|
cpylen = copy_to_user(gId->pObjectName, &xferStr, sizeof(struct nwc_string));
|
|
}
|
|
- }
|
|
+ }
|
|
|
|
out:
|
|
- kfree(reply);
|
|
+ kfree(reply);
|
|
kfree(cmd);
|
|
return (retCode);
|
|
}
|
|
@@ -970,20 +917,15 @@ int novfs_scan_conn_info(struct novfs_xp
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_SCAN_CONN_INFO;
|
|
|
|
- pDConnInfo = (struct nwd_scan_conn_info *) cmd->data;
|
|
+ pDConnInfo = (struct nwd_scan_conn_info *)cmd->data;
|
|
|
|
DbgPrint("Input Data");
|
|
__DbgPrint(" connInfo.uScanIndex = 0x%X\n", connInfo.uScanIndex);
|
|
- __DbgPrint(" connInfo.uConnectionReference = 0x%X\n",
|
|
- connInfo.uConnectionReference);
|
|
- __DbgPrint(" connInfo.uScanInfoLevel = 0x%X\n",
|
|
- connInfo.uScanInfoLevel);
|
|
- __DbgPrint(" connInfo.uScanInfoLen = 0x%X\n",
|
|
- connInfo.uScanInfoLen);
|
|
- __DbgPrint(" connInfo.uReturnInfoLength = 0x%X\n",
|
|
- connInfo.uReturnInfoLength);
|
|
- __DbgPrint(" connInfo.uReturnInfoLevel = 0x%X\n",
|
|
- connInfo.uReturnInfoLevel);
|
|
+ __DbgPrint(" connInfo.uConnectionReference = 0x%X\n", connInfo.uConnectionReference);
|
|
+ __DbgPrint(" connInfo.uScanInfoLevel = 0x%X\n", connInfo.uScanInfoLevel);
|
|
+ __DbgPrint(" connInfo.uScanInfoLen = 0x%X\n", connInfo.uScanInfoLen);
|
|
+ __DbgPrint(" connInfo.uReturnInfoLength = 0x%X\n", connInfo.uReturnInfoLength);
|
|
+ __DbgPrint(" connInfo.uReturnInfoLevel = 0x%X\n", connInfo.uReturnInfoLevel);
|
|
__DbgPrint(" connInfo.uScanFlags = 0x%X\n", connInfo.uScanFlags);
|
|
|
|
pDConnInfo->uScanIndex = connInfo.uScanIndex;
|
|
@@ -995,53 +937,38 @@ int novfs_scan_conn_info(struct novfs_xp
|
|
pDConnInfo->uScanFlags = connInfo.uScanFlags;
|
|
|
|
if (pDConnInfo->uScanInfoLen) {
|
|
- localData = (unsigned char *) pDConnInfo;
|
|
+ localData = (unsigned char *)pDConnInfo;
|
|
pDConnInfo->uScanConnInfoOffset = sizeof(*pDConnInfo);
|
|
localData += pDConnInfo->uScanConnInfoOffset;
|
|
- cpylen = copy_from_user(localData, connInfo.pScanConnInfo,
|
|
- connInfo.uScanInfoLen);
|
|
+ cpylen = copy_from_user(localData, connInfo.pScanConnInfo, connInfo.uScanInfoLen);
|
|
} else {
|
|
pDConnInfo->uScanConnInfoOffset = 0;
|
|
}
|
|
|
|
cmd->dataLen = sizeof(*pDConnInfo);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
DbgPrint("Reply recieved");
|
|
__DbgPrint(" NextIndex = %x\n", connInfo.uScanIndex);
|
|
__DbgPrint(" ErrorCode = %x\n", reply->Reply.ErrorCode);
|
|
__DbgPrint(" data = %p\n", reply->data);
|
|
|
|
- pDConnInfo = (struct nwd_scan_conn_info *) reply->data;
|
|
- retCode = (unsigned long) reply->Reply.ErrorCode;
|
|
+ pDConnInfo = (struct nwd_scan_conn_info *)reply->data;
|
|
+ retCode = (unsigned long)reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
GetUserData(&connInfo, cmd, reply);
|
|
- rInfo = (struct nwc_scan_conn_info *) pdata->repData;
|
|
- cpylen =
|
|
- copy_to_user(pdata->repData,
|
|
- &pDConnInfo->uScanIndex,
|
|
- sizeof(pDConnInfo->
|
|
- uScanIndex));
|
|
+ rInfo = (struct nwc_scan_conn_info *)pdata->repData;
|
|
+ cpylen = copy_to_user(pdata->repData, &pDConnInfo->uScanIndex, sizeof(pDConnInfo->uScanIndex));
|
|
cpylen =
|
|
- copy_to_user(&rInfo->uConnectionReference,
|
|
- &pDConnInfo->
|
|
- uConnectionReference,
|
|
- sizeof(pDConnInfo->
|
|
- uConnectionReference));
|
|
+ copy_to_user(&rInfo->uConnectionReference,
|
|
+ &pDConnInfo->uConnectionReference, sizeof(pDConnInfo->uConnectionReference));
|
|
} else {
|
|
unsigned long x;
|
|
|
|
x = 0;
|
|
- rInfo = (struct nwc_scan_conn_info *) pdata->reqData;
|
|
- cpylen =
|
|
- copy_to_user(&rInfo->uConnectionReference,
|
|
- &x,
|
|
- sizeof(rInfo->
|
|
- uConnectionReference));
|
|
+ rInfo = (struct nwc_scan_conn_info *)pdata->reqData;
|
|
+ cpylen = copy_to_user(&rInfo->uConnectionReference, &x, sizeof(rInfo->uConnectionReference));
|
|
}
|
|
|
|
kfree(reply);
|
|
@@ -1055,17 +982,17 @@ int novfs_scan_conn_info(struct novfs_xp
|
|
/*
|
|
* Copies the user data out of the scan conn info call.
|
|
*/
|
|
-static void GetUserData(struct nwc_scan_conn_info * connInfo, struct novfs_xplat_call_request *cmd, struct novfs_xplat_call_reply *reply)
|
|
+static void GetUserData(struct nwc_scan_conn_info *connInfo, struct novfs_xplat_call_request *cmd,
|
|
+ struct novfs_xplat_call_reply *reply)
|
|
{
|
|
unsigned long uLevel;
|
|
struct nwd_scan_conn_info *pDConnInfo = NULL;
|
|
unsigned char *srcData = NULL;
|
|
unsigned long dataLen = 0, cpylen;
|
|
|
|
- pDConnInfo = (struct nwd_scan_conn_info *) reply->data;
|
|
+ pDConnInfo = (struct nwd_scan_conn_info *)reply->data;
|
|
uLevel = pDConnInfo->uReturnInfoLevel;
|
|
- DbgPrint("uLevel = %d, reply = 0x%p, reply->data = 0x%X",
|
|
- uLevel, reply, reply->data);
|
|
+ DbgPrint("uLevel = %d, reply = 0x%p, reply->data = 0x%X", uLevel, reply, reply->data);
|
|
|
|
switch (uLevel) {
|
|
case NWC_CONN_INFO_RETURN_ALL:
|
|
@@ -1088,7 +1015,7 @@ static void GetUserData(struct nwc_scan_
|
|
case NWC_CONN_INFO_TREE_NAME:
|
|
case NWC_CONN_INFO_SERVER_NAME:
|
|
case NWC_CONN_INFO_VERSION:
|
|
- srcData = (unsigned char *) pDConnInfo;
|
|
+ srcData = (unsigned char *)pDConnInfo;
|
|
srcData += pDConnInfo->uReturnConnInfoOffset;
|
|
dataLen = pDConnInfo->uReturnInfoLength;
|
|
break;
|
|
@@ -1098,14 +1025,13 @@ static void GetUserData(struct nwc_scan_
|
|
unsigned char *dstData = connInfo->pReturnConnInfo;
|
|
struct nwc_tran_addr tranAddr;
|
|
|
|
- srcData = (unsigned char *) reply->data;
|
|
+ srcData = (unsigned char *)reply->data;
|
|
dataLen = reply->dataLen;
|
|
|
|
- DbgPrint("NWC_CONN_INFO_TRAN_ADDR 0x%p -> 0x%p :: 0x%X",
|
|
- srcData, connInfo->pReturnConnInfo, dataLen);
|
|
+ DbgPrint("NWC_CONN_INFO_TRAN_ADDR 0x%p -> 0x%p :: 0x%X", srcData, connInfo->pReturnConnInfo, dataLen);
|
|
|
|
cpylen = copy_from_user(&tranAddr, dstData, sizeof(tranAddr));
|
|
- if (((struct nwd_scan_conn_info *) srcData)->uReturnConnInfoOffset >= reply->dataLen)
|
|
+ if (((struct nwd_scan_conn_info *)srcData)->uReturnConnInfoOffset >= reply->dataLen)
|
|
goto out;
|
|
srcData += ((struct nwd_scan_conn_info *)srcData)->uReturnConnInfoOffset;
|
|
tranAddr.uTransportType = ((struct nwd_tran_addr *)srcData)->uTransportType;
|
|
@@ -1114,7 +1040,7 @@ static void GetUserData(struct nwc_scan_
|
|
goto out;
|
|
cpylen = copy_to_user(dstData, &tranAddr, sizeof(tranAddr));
|
|
cpylen = copy_to_user(tranAddr.puAddress,
|
|
- ((struct tagNwdTranAddrEx *) srcData)->Buffer, tranAddr.uAddressLength);
|
|
+ ((struct tagNwdTranAddrEx *)srcData)->Buffer, tranAddr.uAddressLength);
|
|
dataLen = 0;
|
|
break;
|
|
}
|
|
@@ -1129,8 +1055,7 @@ static void GetUserData(struct nwc_scan_
|
|
}
|
|
|
|
if (srcData && dataLen && dataLen <= reply->dataLen) {
|
|
- DbgPrint("Copy Data 0x%p -> 0x%p :: 0x%X",
|
|
- srcData, connInfo->pReturnConnInfo, dataLen);
|
|
+ DbgPrint("Copy Data 0x%p -> 0x%p :: 0x%X", srcData, connInfo->pReturnConnInfo, dataLen);
|
|
cpylen = copy_to_user(connInfo->pReturnConnInfo, srcData, dataLen);
|
|
}
|
|
|
|
@@ -1141,7 +1066,8 @@ out:
|
|
/*
|
|
* Copies the user data out of the scan conn info call.
|
|
*/
|
|
-static void GetConnData(struct nwc_get_conn_info * connInfo, struct novfs_xplat_call_request *cmd, struct novfs_xplat_call_reply *reply)
|
|
+static void GetConnData(struct nwc_get_conn_info *connInfo, struct novfs_xplat_call_request *cmd,
|
|
+ struct novfs_xplat_call_reply *reply)
|
|
{
|
|
unsigned long uLevel;
|
|
struct nwd_conn_info *pDConnInfo = NULL;
|
|
@@ -1149,12 +1075,12 @@ static void GetConnData(struct nwc_get_c
|
|
unsigned char *srcData = NULL;
|
|
unsigned long dataLen = 0, cpylen;
|
|
|
|
- pDConnInfo = (struct nwd_conn_info *) cmd->data;
|
|
+ pDConnInfo = (struct nwd_conn_info *)cmd->data;
|
|
uLevel = pDConnInfo->uInfoLevel;
|
|
|
|
switch (uLevel) {
|
|
case NWC_CONN_INFO_RETURN_ALL:
|
|
- srcData = (unsigned char *) reply->data;
|
|
+ srcData = (unsigned char *)reply->data;
|
|
dataLen = reply->dataLen;
|
|
break;
|
|
|
|
@@ -1167,19 +1093,16 @@ static void GetConnData(struct nwc_get_c
|
|
unsigned char *dstData = connInfo->pConnInfo;
|
|
struct nwc_tran_addr tranAddr;
|
|
|
|
- srcData = (unsigned char *) reply->data;
|
|
+ srcData = (unsigned char *)reply->data;
|
|
|
|
cpylen = copy_from_user(&tranAddr, dstData, sizeof(tranAddr));
|
|
- tranAddr.uTransportType =
|
|
- ((struct tagNwdTranAddrEx *) srcData)->uTransportType;
|
|
- tranAddr.uAddressLength =
|
|
- ((struct tagNwdTranAddrEx *) srcData)->uAddressLength;
|
|
+ tranAddr.uTransportType = ((struct tagNwdTranAddrEx *)srcData)->uTransportType;
|
|
+ tranAddr.uAddressLength = ((struct tagNwdTranAddrEx *)srcData)->uAddressLength;
|
|
if (tranAddr.uAddressLength > MAX_ADDRESS_LENGTH)
|
|
goto out;
|
|
cpylen = copy_to_user(dstData, &tranAddr, sizeof(tranAddr));
|
|
cpylen = copy_to_user(tranAddr.puAddress,
|
|
- ((struct tagNwdTranAddrEx *) srcData)->Buffer,
|
|
- tranAddr.uAddressLength);
|
|
+ ((struct tagNwdTranAddrEx *)srcData)->Buffer, tranAddr.uAddressLength);
|
|
dataLen = 0;
|
|
break;
|
|
}
|
|
@@ -1202,7 +1125,7 @@ static void GetConnData(struct nwc_get_c
|
|
case NWC_CONN_INFO_VERSION:
|
|
case NWC_CONN_INFO_SERVER_NAME:
|
|
case NWC_CONN_INFO_TREE_NAME:
|
|
- srcData = (unsigned char *) reply->data;
|
|
+ srcData = (unsigned char *)reply->data;
|
|
dataLen = reply->dataLen;
|
|
break;
|
|
|
|
@@ -1250,16 +1173,11 @@ int novfs_get_daemon_ver(struct novfs_xp
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_GET_REQUESTER_VERSION;
|
|
cmdlen = sizeof(*cmd);
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
- pDVersion = (struct nwd_get_reqversion *) reply->data;
|
|
- cpylen =
|
|
- copy_to_user(pDVersion, pdata->reqData,
|
|
- sizeof(*pDVersion));
|
|
+ pDVersion = (struct nwd_get_reqversion *)reply->data;
|
|
+ cpylen = copy_to_user(pDVersion, pdata->reqData, sizeof(*pDVersion));
|
|
kfree(reply);
|
|
}
|
|
kfree(cmd);
|
|
@@ -1277,8 +1195,7 @@ int novfs_get_preferred_DS_tree(struct n
|
|
unsigned long cmdlen, datalen, replylen, cpylen;
|
|
unsigned char *dPtr = NULL;
|
|
|
|
- cpylen = copy_from_user(&xplatCall, pdata->reqData,
|
|
- sizeof(struct nwc_get_pref_ds_tree));
|
|
+ cpylen = copy_from_user(&xplatCall, pdata->reqData, sizeof(struct nwc_get_pref_ds_tree));
|
|
if (xplatCall.uTreeLength > NW_MAX_TREE_NAME_LEN)
|
|
return -EINVAL;
|
|
datalen = sizeof(*pDGetTree) + xplatCall.uTreeLength;
|
|
@@ -1294,24 +1211,20 @@ int novfs_get_preferred_DS_tree(struct n
|
|
cmd->NwcCommand = NWC_GET_PREFERRED_DS_TREE;
|
|
cmdlen = sizeof(*cmd);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
- pDGetTree = (struct nwd_get_pref_ds_tree *) reply->data;
|
|
+ pDGetTree = (struct nwd_get_pref_ds_tree *)reply->data;
|
|
if (pDGetTree->DsTreeNameOffset >= reply->dataLen) {
|
|
retCode = -EINVAL;
|
|
goto out;
|
|
}
|
|
dPtr = reply->data + pDGetTree->DsTreeNameOffset;
|
|
- p = (struct nwc_get_pref_ds_tree *) pdata->reqData;
|
|
+ p = (struct nwc_get_pref_ds_tree *)pdata->reqData;
|
|
|
|
DbgPrint("Reply recieved");
|
|
- __DbgPrint(" TreeLen = %x\n",
|
|
- pDGetTree->uTreeLength);
|
|
+ __DbgPrint(" TreeLen = %x\n", pDGetTree->uTreeLength);
|
|
__DbgPrint(" TreeName = %s\n", dPtr);
|
|
|
|
if (pDGetTree->uTreeLength > reply->dataLen - pDGetTree->DsTreeNameOffset) {
|
|
@@ -1355,18 +1268,14 @@ int novfs_set_preferred_DS_tree(struct n
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_SET_PREFERRED_DS_TREE;
|
|
|
|
- pDSetTree = (struct nwd_set_pref_ds_tree *) cmd->data;
|
|
+ pDSetTree = (struct nwd_set_pref_ds_tree *)cmd->data;
|
|
pDSetTree->DsTreeNameOffset = sizeof(*pDSetTree);
|
|
pDSetTree->uTreeLength = xplatCall.uTreeLength;
|
|
|
|
dPtr = cmd->data + sizeof(*pDSetTree);
|
|
- cpylen = copy_from_user(dPtr, xplatCall.pDsTreeName,
|
|
- xplatCall.uTreeLength);
|
|
+ cpylen = copy_from_user(dPtr, xplatCall.pDsTreeName, xplatCall.uTreeLength);
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -1376,19 +1285,17 @@ int novfs_set_preferred_DS_tree(struct n
|
|
|
|
}
|
|
|
|
-int novfs_set_default_ctx(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session)
|
|
+int novfs_set_default_ctx(struct novfs_xplat *pdata, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
struct nwc_set_def_name_ctx xplatCall;
|
|
- struct nwd_set_def_name_ctx * pDSet = NULL;
|
|
+ struct nwd_set_def_name_ctx *pDSet = NULL;
|
|
int retCode = -ENOMEM;
|
|
unsigned long cmdlen, datalen, replylen, cpylen;
|
|
unsigned char *dPtr = NULL;
|
|
|
|
- cpylen = copy_from_user(&xplatCall, pdata->reqData,
|
|
- sizeof(struct nwc_set_def_name_ctx));
|
|
+ cpylen = copy_from_user(&xplatCall, pdata->reqData, sizeof(struct nwc_set_def_name_ctx));
|
|
if (xplatCall.uNameLength > MAX_NAME_LEN || xplatCall.uTreeLength > NW_MAX_TREE_NAME_LEN)
|
|
return -EINVAL;
|
|
datalen = sizeof(*pDSet) + xplatCall.uTreeLength + xplatCall.uNameLength;
|
|
@@ -1403,7 +1310,7 @@ int novfs_set_default_ctx(struct novfs_x
|
|
cmd->NwcCommand = NWC_SET_DEFAULT_NAME_CONTEXT;
|
|
cmd->dataLen = sizeof(struct nwd_set_def_name_ctx) + xplatCall.uTreeLength + xplatCall.uNameLength;
|
|
|
|
- pDSet = (struct nwd_set_def_name_ctx *) cmd->data;
|
|
+ pDSet = (struct nwd_set_def_name_ctx *)cmd->data;
|
|
dPtr = cmd->data;
|
|
|
|
pDSet->TreeOffset = sizeof(struct nwd_set_def_name_ctx);
|
|
@@ -1413,14 +1320,9 @@ int novfs_set_default_ctx(struct novfs_x
|
|
|
|
//sgled cpylen = copy_from_user(dPtr+pDSet->TreeOffset, xplatCall.pTreeName, xplatCall.uTreeLength);
|
|
cpylen = copy_from_user(dPtr + pDSet->TreeOffset, xplatCall.pDsTreeName, xplatCall.uTreeLength); //sgled
|
|
- cpylen = copy_from_user(dPtr + pDSet->NameContextOffset,
|
|
- xplatCall.pNameContext,
|
|
- xplatCall.uNameLength);
|
|
-
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ cpylen = copy_from_user(dPtr + pDSet->NameContextOffset, xplatCall.pNameContext, xplatCall.uNameLength);
|
|
+
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -1430,23 +1332,21 @@ int novfs_set_default_ctx(struct novfs_x
|
|
|
|
}
|
|
|
|
-int novfs_get_default_ctx(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session)
|
|
+int novfs_get_default_ctx(struct novfs_xplat *pdata, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
struct nwc_get_def_name_ctx xplatCall;
|
|
- struct nwd_get_def_name_ctx * pGet = NULL;
|
|
+ struct nwd_get_def_name_ctx *pGet = NULL;
|
|
char *dPtr = NULL;
|
|
int retCode = -ENOMEM;
|
|
unsigned long cmdlen, replylen, cpylen;
|
|
|
|
- cpylen = copy_from_user(&xplatCall, pdata->reqData,
|
|
- sizeof(struct nwc_get_def_name_ctx));
|
|
+ cpylen = copy_from_user(&xplatCall, pdata->reqData, sizeof(struct nwc_get_def_name_ctx));
|
|
if (xplatCall.uTreeLength > NW_MAX_TREE_NAME_LEN)
|
|
return -EINVAL;
|
|
|
|
- cmdlen = sizeof(*cmd) + sizeof(struct nwd_get_def_name_ctx ) + xplatCall.uTreeLength;
|
|
+ cmdlen = sizeof(*cmd) + sizeof(struct nwd_get_def_name_ctx) + xplatCall.uTreeLength;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
|
|
if (!cmd)
|
|
@@ -1455,40 +1355,31 @@ int novfs_get_default_ctx(struct novfs_x
|
|
cmd->Command.SequenceNumber = 0;
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_GET_DEFAULT_NAME_CONTEXT;
|
|
- cmd->dataLen =
|
|
- sizeof(struct nwd_get_def_name_ctx) + xplatCall.uTreeLength;
|
|
+ cmd->dataLen = sizeof(struct nwd_get_def_name_ctx) + xplatCall.uTreeLength;
|
|
|
|
- pGet = (struct nwd_get_def_name_ctx *) cmd->data;
|
|
+ pGet = (struct nwd_get_def_name_ctx *)cmd->data;
|
|
dPtr = cmd->data;
|
|
|
|
- pGet->TreeOffset = sizeof(struct nwd_get_def_name_ctx );
|
|
+ pGet->TreeOffset = sizeof(struct nwd_get_def_name_ctx);
|
|
pGet->uTreeLength = xplatCall.uTreeLength;
|
|
|
|
//sgled cpylen = copy_from_user( dPtr + pGet->TreeOffset, xplatCall.pTreeName, xplatCall.uTreeLength);
|
|
cpylen = copy_from_user(dPtr + pGet->TreeOffset, xplatCall.pDsTreeName, xplatCall.uTreeLength); //sgled
|
|
dPtr[pGet->TreeOffset + pGet->uTreeLength] = 0;
|
|
|
|
- retCode =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ retCode = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
retCode = reply->Reply.ErrorCode;
|
|
if (!retCode) {
|
|
- pGet = (struct nwd_get_def_name_ctx *) reply->data;
|
|
+ pGet = (struct nwd_get_def_name_ctx *)reply->data;
|
|
|
|
- DbgPrint("retCode=0x%x uNameLength1=%d uNameLength2=%d",
|
|
- retCode, pGet->uNameLength,
|
|
- xplatCall.uNameLength);
|
|
+ DbgPrint("retCode=0x%x uNameLength1=%d uNameLength2=%d", retCode, pGet->uNameLength, xplatCall.uNameLength);
|
|
if (xplatCall.uNameLength < pGet->uNameLength) {
|
|
- pGet->uNameLength =
|
|
- xplatCall.uNameLength;
|
|
+ pGet->uNameLength = xplatCall.uNameLength;
|
|
retCode = NWE_BUFFER_OVERFLOW;
|
|
}
|
|
dPtr = (char *)pGet + pGet->NameContextOffset;
|
|
- cpylen =
|
|
- copy_to_user(xplatCall.pNameContext, dPtr,
|
|
- pGet->uNameLength);
|
|
+ cpylen = copy_to_user(xplatCall.pNameContext, dPtr, pGet->uNameLength);
|
|
}
|
|
|
|
kfree(reply);
|
|
@@ -1504,8 +1395,7 @@ int novfs_query_feature(struct novfs_xpl
|
|
int status = 0;
|
|
unsigned long cpylen;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&xpCall, pdata->reqData, sizeof(struct nwc_query_feature));
|
|
+ cpylen = copy_from_user(&xpCall, pdata->reqData, sizeof(struct nwc_query_feature));
|
|
switch (xpCall.Feature) {
|
|
case NWC_FEAT_NDS:
|
|
case NWC_FEAT_NDS_MTREE:
|
|
@@ -1518,8 +1408,7 @@ int novfs_query_feature(struct novfs_xpl
|
|
return (status);
|
|
}
|
|
|
|
-int novfs_get_tree_monitored_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session)
|
|
+int novfs_get_tree_monitored_conn(struct novfs_xplat *pdata, struct novfs_schandle Session)
|
|
{
|
|
struct novfs_xplat_call_request *cmd = NULL;
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
@@ -1528,9 +1417,7 @@ int novfs_get_tree_monitored_conn(struct
|
|
char *dPtr = NULL;
|
|
unsigned long status = -ENOMEM, cmdlen, datalen, replylen, cpylen;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&xplatCall, pdata->reqData,
|
|
- sizeof(struct nwc_get_tree_monitored_conn_ref));
|
|
+ cpylen = copy_from_user(&xplatCall, pdata->reqData, sizeof(struct nwc_get_tree_monitored_conn_ref));
|
|
if (!access_ok(VERIFY_READ, xplatCall.pTreeName, sizeof(struct nwc_string)))
|
|
return -EINVAL;
|
|
if (xplatCall.pTreeName->DataLen > NW_MAX_TREE_NAME_LEN)
|
|
@@ -1547,26 +1434,19 @@ int novfs_get_tree_monitored_conn(struct
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_GET_TREE_MONITORED_CONN_REF;
|
|
|
|
- pDConnRef = (struct nwd_get_tree_monitored_conn_ref *) cmd->data;
|
|
+ pDConnRef = (struct nwd_get_tree_monitored_conn_ref *)cmd->data;
|
|
pDConnRef->TreeName.boffset = sizeof(*pDConnRef);
|
|
pDConnRef->TreeName.len = xplatCall.pTreeName->DataLen;
|
|
pDConnRef->TreeName.type = xplatCall.pTreeName->DataType;
|
|
|
|
dPtr = cmd->data + sizeof(*pDConnRef);
|
|
- cpylen =
|
|
- copy_from_user(dPtr, xplatCall.pTreeName->pBuffer,
|
|
- pDConnRef->TreeName.len);
|
|
- status =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ cpylen = copy_from_user(dPtr, xplatCall.pTreeName->pBuffer, pDConnRef->TreeName.len);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
- pDConnRef = (struct nwd_get_tree_monitored_conn_ref *) reply->data;
|
|
+ pDConnRef = (struct nwd_get_tree_monitored_conn_ref *)reply->data;
|
|
dPtr = reply->data + pDConnRef->TreeName.boffset;
|
|
- p = (struct nwc_get_tree_monitored_conn_ref *) pdata->reqData;
|
|
- cpylen =
|
|
- copy_to_user(&p->uConnReference,
|
|
- &pDConnRef->uConnReference, 4);
|
|
+ p = (struct nwc_get_tree_monitored_conn_ref *)pdata->reqData;
|
|
+ cpylen = copy_to_user(&p->uConnReference, &pDConnRef->uConnReference, 4);
|
|
|
|
status = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -1585,9 +1465,7 @@ int novfs_enum_ids(struct novfs_xplat *p
|
|
char *str = NULL;
|
|
unsigned long status = -ENOMEM, cmdlen, datalen, replylen, cpylen;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&xplatCall, pdata->reqData,
|
|
- sizeof(struct nwc_enum_ids));
|
|
+ cpylen = copy_from_user(&xplatCall, pdata->reqData, sizeof(struct nwc_enum_ids));
|
|
datalen = sizeof(*pEnum);
|
|
cmdlen = datalen + sizeof(*cmd);
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
@@ -1604,66 +1482,40 @@ int novfs_enum_ids(struct novfs_xplat *p
|
|
__DbgPrint(" iterator = %x\n", xplatCall.Iterator);
|
|
__DbgPrint(" cmdlen = %d\n", cmdlen);
|
|
|
|
- pEnum = (struct nwd_enum_ids *) cmd->data;
|
|
+ pEnum = (struct nwd_enum_ids *)cmd->data;
|
|
pEnum->Iterator = xplatCall.Iterator;
|
|
- status =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
|
|
eId = pdata->repData;
|
|
- pEnum = (struct nwd_enum_ids *) reply->data;
|
|
- cpylen =
|
|
- copy_to_user(&eId->Iterator, &pEnum->Iterator,
|
|
- sizeof(pEnum->Iterator));
|
|
- DbgPrint("[XPLAT NWCAPI] Found AuthId 0x%X",
|
|
- pEnum->AuthenticationId);
|
|
- cpylen =
|
|
- copy_to_user(&eId->AuthenticationId,
|
|
- &pEnum->AuthenticationId,
|
|
- sizeof(pEnum->AuthenticationId));
|
|
- cpylen =
|
|
- copy_to_user(&eId->AuthType, &pEnum->AuthType,
|
|
- sizeof(pEnum->AuthType));
|
|
- cpylen =
|
|
- copy_to_user(&eId->IdentityFlags,
|
|
- &pEnum->IdentityFlags,
|
|
- sizeof(pEnum->IdentityFlags));
|
|
- cpylen =
|
|
- copy_to_user(&eId->NameType, &pEnum->NameType,
|
|
- sizeof(pEnum->NameType));
|
|
- cpylen =
|
|
- copy_to_user(&eId->ObjectType, &pEnum->ObjectType,
|
|
- sizeof(pEnum->ObjectType));
|
|
+ pEnum = (struct nwd_enum_ids *)reply->data;
|
|
+ cpylen = copy_to_user(&eId->Iterator, &pEnum->Iterator, sizeof(pEnum->Iterator));
|
|
+ DbgPrint("[XPLAT NWCAPI] Found AuthId 0x%X", pEnum->AuthenticationId);
|
|
+ cpylen = copy_to_user(&eId->AuthenticationId, &pEnum->AuthenticationId, sizeof(pEnum->AuthenticationId));
|
|
+ cpylen = copy_to_user(&eId->AuthType, &pEnum->AuthType, sizeof(pEnum->AuthType));
|
|
+ cpylen = copy_to_user(&eId->IdentityFlags, &pEnum->IdentityFlags, sizeof(pEnum->IdentityFlags));
|
|
+ cpylen = copy_to_user(&eId->NameType, &pEnum->NameType, sizeof(pEnum->NameType));
|
|
+ cpylen = copy_to_user(&eId->ObjectType, &pEnum->ObjectType, sizeof(pEnum->ObjectType));
|
|
|
|
if (!status) {
|
|
- cpylen =
|
|
- copy_from_user(&xferStr, eId->pDomainName,
|
|
- sizeof(struct nwc_string));
|
|
+ cpylen = copy_from_user(&xferStr, eId->pDomainName, sizeof(struct nwc_string));
|
|
if (pEnum->domainNameOffset >= reply->dataLen) {
|
|
status = -EINVAL;
|
|
goto out;
|
|
}
|
|
- str =
|
|
- (char *)((char *)reply->data +
|
|
- pEnum->domainNameOffset);
|
|
+ str = (char *)((char *)reply->data + pEnum->domainNameOffset);
|
|
DbgPrint("[XPLAT NWCAPI] Found Domain %s", str);
|
|
if (pEnum->domainNameLen > reply->dataLen - pEnum->domainNameOffset) {
|
|
status = -EINVAL;
|
|
goto out;
|
|
}
|
|
- cpylen =
|
|
- copy_to_user(xferStr.pBuffer, str,
|
|
- pEnum->domainNameLen);
|
|
+ cpylen = copy_to_user(xferStr.pBuffer, str, pEnum->domainNameLen);
|
|
xferStr.DataType = NWC_STRING_TYPE_ASCII;
|
|
xferStr.DataLen = pEnum->domainNameLen - 1;
|
|
- cpylen = copy_to_user(eId->pDomainName, &xferStr,
|
|
- sizeof(struct nwc_string));
|
|
+ cpylen = copy_to_user(eId->pDomainName, &xferStr, sizeof(struct nwc_string));
|
|
|
|
- cpylen = copy_from_user(&xferStr, eId->pObjectName,
|
|
- sizeof(struct nwc_string));
|
|
+ cpylen = copy_from_user(&xferStr, eId->pObjectName, sizeof(struct nwc_string));
|
|
if (pEnum->objectNameOffset >= reply->dataLen) {
|
|
status = -EINVAL;
|
|
goto out;
|
|
@@ -1704,14 +1556,12 @@ int novfs_change_auth_key(struct novfs_x
|
|
return -EINVAL;
|
|
if (xplatCall.pDomainName->DataLen > MAX_DOMAIN_LEN ||
|
|
xplatCall.pObjectName->DataLen > MAX_OBJECT_NAME_LENGTH ||
|
|
- xplatCall.pNewPassword->DataLen > MAX_PASSWORD_LENGTH ||
|
|
- xplatCall.pVerifyPassword->DataLen > MAX_PASSWORD_LENGTH)
|
|
+ xplatCall.pNewPassword->DataLen > MAX_PASSWORD_LENGTH || xplatCall.pVerifyPassword->DataLen > MAX_PASSWORD_LENGTH)
|
|
return -EINVAL;
|
|
|
|
datalen =
|
|
sizeof(struct nwd_change_key) + xplatCall.pDomainName->DataLen +
|
|
- xplatCall.pObjectName->DataLen + xplatCall.pNewPassword->DataLen +
|
|
- xplatCall.pVerifyPassword->DataLen;
|
|
+ xplatCall.pObjectName->DataLen + xplatCall.pNewPassword->DataLen + xplatCall.pVerifyPassword->DataLen;
|
|
|
|
cmdlen = sizeof(*cmd) + datalen;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
@@ -1719,7 +1569,7 @@ int novfs_change_auth_key(struct novfs_x
|
|
if (!cmd)
|
|
return -ENOMEM;
|
|
|
|
- pNewKey = (struct nwd_change_key *) cmd->data;
|
|
+ pNewKey = (struct nwd_change_key *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
cmd->Command.CommandType = VFS_COMMAND_XPLAT_CALL;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -1783,9 +1633,7 @@ int novfs_change_auth_key(struct novfs_x
|
|
cpylen = copy_from_user(str, xferStr.pBuffer, xferStr.DataLen);
|
|
pNewKey->verifyPasswordLen = xferStr.DataLen;
|
|
|
|
- status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
|
|
@@ -1805,9 +1653,7 @@ int novfs_set_pri_conn(struct novfs_xpla
|
|
struct nwd_set_primary_conn *pConn = NULL;
|
|
unsigned long status = -ENOMEM, cmdlen, datalen, replylen, cpylen;
|
|
|
|
- cpylen =
|
|
- copy_from_user(&xplatCall, pdata->reqData,
|
|
- sizeof(struct nwc_set_primary_conn));
|
|
+ cpylen = copy_from_user(&xplatCall, pdata->reqData, sizeof(struct nwc_set_primary_conn));
|
|
|
|
datalen = sizeof(struct nwd_set_primary_conn);
|
|
cmdlen = sizeof(*cmd) + datalen;
|
|
@@ -1815,17 +1661,14 @@ int novfs_set_pri_conn(struct novfs_xpla
|
|
if (!cmd)
|
|
return -ENOMEM;
|
|
|
|
- pConn = (struct nwd_set_primary_conn *) cmd->data;
|
|
+ pConn = (struct nwd_set_primary_conn *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
cmd->Command.CommandType = VFS_COMMAND_XPLAT_CALL;
|
|
cmd->Command.SequenceNumber = 0;
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_SET_PRIMARY_CONN;
|
|
- pConn->ConnHandle = (void *) (unsigned long) xplatCall.ConnHandle;
|
|
- status =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ pConn->ConnHandle = (void *)(unsigned long)xplatCall.ConnHandle;
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
@@ -1841,7 +1684,7 @@ int novfs_get_pri_conn(struct novfs_xpla
|
|
struct novfs_xplat_call_reply *reply = NULL;
|
|
unsigned long status = -ENOMEM, cmdlen, replylen, cpylen;
|
|
|
|
- cmdlen = (unsigned long) (&((struct novfs_xplat_call_request *) 0)->data);
|
|
+ cmdlen = (unsigned long)(&((struct novfs_xplat_call_request *)0)->data);
|
|
|
|
cmd.dataLen = 0;
|
|
cmd.Command.CommandType = VFS_COMMAND_XPLAT_CALL;
|
|
@@ -1849,16 +1692,12 @@ int novfs_get_pri_conn(struct novfs_xpla
|
|
cmd.Command.SessionId = Session;
|
|
cmd.NwcCommand = NWC_GET_PRIMARY_CONN;
|
|
|
|
- status =
|
|
- Queue_Daemon_Command((void *)&cmd, cmdlen, NULL, 0, (void **)&reply,
|
|
- &replylen, INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)&cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
if (!status) {
|
|
- cpylen =
|
|
- copy_to_user(pdata->repData, reply->data,
|
|
- sizeof(unsigned long));
|
|
+ cpylen = copy_to_user(pdata->repData, reply->data, sizeof(unsigned long));
|
|
}
|
|
|
|
kfree(reply);
|
|
@@ -1881,13 +1720,11 @@ int novfs_set_map_drive(struct novfs_xpl
|
|
return -EFAULT;
|
|
if (symInfo.dirPathOffsetLength > MAX_OFFSET_LEN || symInfo.linkOffsetLength > MAX_OFFSET_LEN)
|
|
return -EINVAL;
|
|
- datalen = sizeof(symInfo) + symInfo.dirPathOffsetLength +
|
|
- symInfo.linkOffsetLength;
|
|
+ datalen = sizeof(symInfo) + symInfo.dirPathOffsetLength + symInfo.linkOffsetLength;
|
|
|
|
__DbgPrint(" cmdlen = %d\n", cmdlen);
|
|
__DbgPrint(" dataLen = %d\n", datalen);
|
|
- __DbgPrint(" symInfo.dirPathOffsetLength = %d\n",
|
|
- symInfo.dirPathOffsetLength);
|
|
+ __DbgPrint(" symInfo.dirPathOffsetLength = %d\n", symInfo.dirPathOffsetLength);
|
|
__DbgPrint(" symInfo.linkOffsetLength = %d\n", symInfo.linkOffsetLength);
|
|
__DbgPrint(" pdata->datalen = %d\n", pdata->reqLen);
|
|
|
|
@@ -1909,10 +1746,7 @@ int novfs_set_map_drive(struct novfs_xpl
|
|
kfree(cmd);
|
|
return -EFAULT;
|
|
}
|
|
- status =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
@@ -1950,9 +1784,7 @@ int novfs_unmap_drive(struct novfs_xplat
|
|
cmd->NwcCommand = NWC_UNMAP_DRIVE;
|
|
|
|
cpylen = copy_from_user(cmd->data, pdata->reqData, datalen);
|
|
- status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
@@ -1982,29 +1814,23 @@ int novfs_enum_drives(struct novfs_xplat
|
|
cmd->Command.SequenceNumber = 0;
|
|
cmd->Command.SessionId = Session;
|
|
cmd->NwcCommand = NWC_ENUMERATE_DRIVES;
|
|
- status =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
DbgPrint("Status Code = 0x%X", status);
|
|
if (!status) {
|
|
- offset = sizeof(((struct nwc_get_mapped_drives *) pdata->
|
|
- repData)->MapBuffLen);
|
|
+ offset = sizeof(((struct nwc_get_mapped_drives *) pdata->repData)->MapBuffLen);
|
|
cp = reply->data;
|
|
- replylen = ((struct nwc_get_mapped_drives *) pdata->repData)->MapBuffLen;
|
|
+ replylen = ((struct nwc_get_mapped_drives *)pdata->repData)->MapBuffLen;
|
|
if (offset > reply->dataLen) {
|
|
status = -EINVAL;
|
|
goto out;
|
|
}
|
|
cpylen = copy_to_user(pdata->repData, cp, offset);
|
|
cp += offset;
|
|
- cpylen = copy_to_user(((struct nwc_get_mapped_drives *) pdata->
|
|
- repData)->MapBuffer, cp,
|
|
- min(replylen - offset,
|
|
- reply->dataLen - offset));
|
|
+ cpylen = copy_to_user(((struct nwc_get_mapped_drives *)pdata->repData)->MapBuffer, cp,
|
|
+ min(replylen - offset, reply->dataLen - offset));
|
|
}
|
|
}
|
|
out:
|
|
@@ -2034,13 +1860,10 @@ int novfs_get_bcast_msg(struct novfs_xpl
|
|
cmd->Command.SessionId = Session;
|
|
|
|
cmd->NwcCommand = NWC_GET_BROADCAST_MESSAGE;
|
|
- dmsg = (struct nwd_get_bcast_notification *) cmd->data;
|
|
- dmsg->uConnReference = (void *) (unsigned long) msg.uConnReference;
|
|
+ dmsg = (struct nwd_get_bcast_notification *)cmd->data;
|
|
+ dmsg->uConnReference = (void *)(unsigned long)msg.uConnReference;
|
|
|
|
- status =
|
|
- Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
@@ -2048,7 +1871,7 @@ int novfs_get_bcast_msg(struct novfs_xpl
|
|
if (!status) {
|
|
char *cp = pdata->repData;
|
|
|
|
- dmsg = (struct nwd_get_bcast_notification *) reply->data;
|
|
+ dmsg = (struct nwd_get_bcast_notification *)reply->data;
|
|
if (pdata->repLen < dmsg->messageLen) {
|
|
dmsg->messageLen = pdata->repLen;
|
|
}
|
|
@@ -2085,7 +1908,7 @@ int novfs_set_key_value(struct novfs_xpl
|
|
|
|
if (cstrObjectName.DataLen > MAX_OBJECT_NAME_LENGTH || cstrPassword.DataLen > MAX_PASSWORD_LENGTH)
|
|
return -EINVAL;
|
|
- datalen = sizeof(struct nwd_set_key ) + cstrObjectName.DataLen + cstrPassword.DataLen;
|
|
+ datalen = sizeof(struct nwd_set_key) + cstrObjectName.DataLen + cstrPassword.DataLen;
|
|
|
|
cmdlen = sizeof(*cmd) + datalen;
|
|
cmd = kmalloc(cmdlen, GFP_KERNEL);
|
|
@@ -2093,7 +1916,7 @@ int novfs_set_key_value(struct novfs_xpl
|
|
if (!cmd)
|
|
return -ENOMEM;
|
|
|
|
- pNewKey = (struct nwd_set_key *) cmd->data;
|
|
+ pNewKey = (struct nwd_set_key *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
cmd->Command.CommandType = VFS_COMMAND_XPLAT_CALL;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -2102,19 +1925,17 @@ int novfs_set_key_value(struct novfs_xpl
|
|
|
|
pNewKey->ObjectType = xplatCall.ObjectType;
|
|
pNewKey->AuthenticationId = xplatCall.AuthenticationId;
|
|
- pNewKey->ConnHandle = (void *) (unsigned long) xplatCall.ConnHandle;
|
|
+ pNewKey->ConnHandle = (void *)(unsigned long)xplatCall.ConnHandle;
|
|
str = (char *)pNewKey;
|
|
|
|
/*
|
|
* Get the User Name
|
|
*/
|
|
- str += sizeof(struct nwd_set_key );
|
|
- cpylen =
|
|
- copy_from_user(str, cstrObjectName.pBuffer,
|
|
- cstrObjectName.DataLen);
|
|
+ str += sizeof(struct nwd_set_key);
|
|
+ cpylen = copy_from_user(str, cstrObjectName.pBuffer, cstrObjectName.DataLen);
|
|
|
|
str += pNewKey->objectNameLen = cstrObjectName.DataLen;
|
|
- pNewKey->objectNameOffset = sizeof(struct nwd_set_key );
|
|
+ pNewKey->objectNameOffset = sizeof(struct nwd_set_key);
|
|
|
|
/*
|
|
* Get the Verify Password
|
|
@@ -2124,9 +1945,7 @@ int novfs_set_key_value(struct novfs_xpl
|
|
pNewKey->newPasswordLen = cstrPassword.DataLen;
|
|
pNewKey->newPasswordOffset = pNewKey->objectNameOffset + pNewKey->objectNameLen;
|
|
|
|
- status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -2164,7 +1983,7 @@ int novfs_verify_key_value(struct novfs_
|
|
if (!cmd)
|
|
return -ENOMEM;
|
|
|
|
- pNewKey = (struct nwd_verify_key *) cmd->data;
|
|
+ pNewKey = (struct nwd_verify_key *)cmd->data;
|
|
cmd->dataLen = datalen;
|
|
cmd->Command.CommandType = VFS_COMMAND_XPLAT_CALL;
|
|
cmd->Command.SequenceNumber = 0;
|
|
@@ -2180,9 +1999,7 @@ int novfs_verify_key_value(struct novfs_
|
|
* Get the tree name
|
|
*/
|
|
str += sizeof(*pNewKey);
|
|
- cpylen =
|
|
- copy_from_user(&xferStr, xplatCall.pDomainName,
|
|
- sizeof(struct nwc_string));
|
|
+ cpylen = copy_from_user(&xferStr, xplatCall.pDomainName, sizeof(struct nwc_string));
|
|
pNewKey->domainNameOffset = sizeof(*pNewKey);
|
|
cpylen = copy_from_user(str, xferStr.pBuffer, xferStr.DataLen);
|
|
pNewKey->domainNameLen = xferStr.DataLen;
|
|
@@ -2191,8 +2008,7 @@ int novfs_verify_key_value(struct novfs_
|
|
* Get the User Name
|
|
*/
|
|
str += pNewKey->domainNameLen;
|
|
- cpylen = copy_from_user(&xferStr, xplatCall.pObjectName,
|
|
- sizeof(struct nwc_string));
|
|
+ cpylen = copy_from_user(&xferStr, xplatCall.pObjectName, sizeof(struct nwc_string));
|
|
pNewKey->objectNameOffset = pNewKey->domainNameOffset + pNewKey->domainNameLen;
|
|
cpylen = copy_from_user(str, xferStr.pBuffer, xferStr.DataLen);
|
|
pNewKey->objectNameLen = xferStr.DataLen;
|
|
@@ -2201,16 +2017,12 @@ int novfs_verify_key_value(struct novfs_
|
|
* Get the Verify Password
|
|
*/
|
|
str += pNewKey->objectNameLen;
|
|
- cpylen = copy_from_user(&xferStr, xplatCall.pVerifyPassword,
|
|
- sizeof(struct nwc_string));
|
|
- pNewKey->verifyPasswordOffset =
|
|
- pNewKey->objectNameOffset + pNewKey->objectNameLen;
|
|
+ cpylen = copy_from_user(&xferStr, xplatCall.pVerifyPassword, sizeof(struct nwc_string));
|
|
+ pNewKey->verifyPasswordOffset = pNewKey->objectNameOffset + pNewKey->objectNameLen;
|
|
cpylen = copy_from_user(str, xferStr.pBuffer, xferStr.DataLen);
|
|
pNewKey->verifyPasswordLen = xferStr.DataLen;
|
|
|
|
- status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0,
|
|
- (void **)&reply, &replylen,
|
|
- INTERRUPTIBLE);
|
|
+ status = Queue_Daemon_Command((void *)cmd, cmdlen, NULL, 0, (void **)&reply, &replylen, INTERRUPTIBLE);
|
|
if (reply) {
|
|
status = reply->Reply.ErrorCode;
|
|
kfree(reply);
|
|
@@ -2218,4 +2030,3 @@ int novfs_verify_key_value(struct novfs_
|
|
kfree(cmd);
|
|
return (status);
|
|
}
|
|
-
|
|
--- a/fs/novfs/nwcapi.h
|
|
+++ b/fs/novfs/nwcapi.h
|
|
@@ -14,7 +14,7 @@
|
|
#ifndef __NWCLNX_H__
|
|
#define __NWCLNX_H__
|
|
|
|
-#if 0 //sgled hack
|
|
+#if 0 //sgled hack
|
|
#else //sgled hack (up to endif)
|
|
|
|
#define NW_MAX_TREE_NAME_LEN 33
|
|
@@ -120,8 +120,7 @@ struct novfs_xplat {
|
|
|
|
#if 0
|
|
N_EXTERN_LIBRARY(NWRCODE)
|
|
- NWCLnxReq
|
|
- (nuint32 request, nptr pInBuf, nuint32 inLen, nptr pOutBuf, nuint32 outLen);
|
|
+ NWCLnxReq(nuint32 request, nptr pInBuf, nuint32 inLen, nptr pOutBuf, nuint32 outLen);
|
|
#endif
|
|
//
|
|
// Network Name Format Type
|
|
@@ -302,13 +301,12 @@ N_EXTERN_LIBRARY(NWRCODE)
|
|
#define MIN_NUM_REPLIES 1
|
|
#define MAX_NUM_REQUESTS 4096
|
|
#define MIN_NUM_REQUESTS 1
|
|
-#define MAX_FRAG_SIZE 4096
|
|
+#define MAX_FRAG_SIZE 4096
|
|
#define MIN_FRAG_SIZE 1
|
|
#define MAX_INFO_LEN 4096
|
|
#define MAX_DOMAIN_LEN MAX_NETWORK_NAME_LENGTH
|
|
#define MAX_OFFSET_LEN 4096
|
|
|
|
-
|
|
//
|
|
// Flags for the GetBroadcastMessage API
|
|
//
|
|
@@ -338,7 +336,6 @@ N_EXTERN_LIBRARY(NWRCODE)
|
|
|
|
//===[ Type definitions ]==================================================
|
|
|
|
-
|
|
//
|
|
// Structure for defining what a transport
|
|
// address looks like
|
|
@@ -350,7 +347,6 @@ struct nwc_tran_addr {
|
|
unsigned char *puAddress;
|
|
};
|
|
|
|
-
|
|
struct nwc_conn_string {
|
|
char *pString;
|
|
u32 uStringType;
|
|
@@ -501,7 +497,6 @@ struct nwc_convert_netware_handle {
|
|
u32 uFileSize;
|
|
};
|
|
|
|
-
|
|
//++=======================================================================
|
|
// API Name: NwcGetConnInfo
|
|
//
|
|
@@ -617,7 +612,6 @@ struct nwc_get_tree_monitored_conn_ref {
|
|
|
|
};
|
|
|
|
-
|
|
//++=======================================================================
|
|
// API Name: NwcGetPreferredDsTree
|
|
//
|
|
@@ -678,7 +672,6 @@ struct nwc_license_conn {
|
|
u32 ConnHandle;
|
|
};
|
|
|
|
-
|
|
//++=======================================================================
|
|
// API Name: NWCGetMappedDrives
|
|
//
|
|
@@ -1171,7 +1164,6 @@ struct nwc_set_primary_conn {
|
|
|
|
};
|
|
|
|
-
|
|
//++=======================================================================
|
|
// API Name: NwcQueryFeature
|
|
//
|
|
@@ -1316,7 +1308,6 @@ struct nwc_login_id {
|
|
|
|
};
|
|
|
|
-
|
|
//++=======================================================================
|
|
// API Name: NWCSetPassword
|
|
//
|
|
@@ -1401,7 +1392,6 @@ struct nwc_auth_with_id {
|
|
|
|
};
|
|
|
|
-
|
|
struct nwc_unmap_drive_ex {
|
|
// unsigned long connHdl;
|
|
unsigned int linkLen;
|
|
--- a/fs/novfs/nwerror.h
|
|
+++ b/fs/novfs/nwerror.h
|
|
@@ -14,7 +14,6 @@
|
|
#ifndef __NOVFS_ERROR_H
|
|
#define __NOVFS_ERROR_H
|
|
|
|
-
|
|
/*
|
|
* Network errors
|
|
* Decimal values at end of line are 32768 lower than actual
|
|
@@ -655,4 +654,4 @@
|
|
#define NWE_LOCK_ERROR 0x89FF // 255
|
|
#define NWE_FAILURE 0x89FF // 255 Generic Failure
|
|
|
|
-#endif /* __NOVFS_ERROR_H */
|
|
+#endif /* __NOVFS_ERROR_H */
|
|
--- a/fs/novfs/proc.c
|
|
+++ b/fs/novfs/proc.c
|
|
@@ -47,9 +47,7 @@ static int Novfs_Get_Version(char *page,
|
|
if (novfs_current_mnt) {
|
|
i = strlen(novfs_current_mnt);
|
|
if ((i > 0) && i < (count - len)) {
|
|
- len +=
|
|
- sprintf(buf + len, "Novfs mount=%s\n",
|
|
- novfs_current_mnt);
|
|
+ len += sprintf(buf + len, "Novfs mount=%s\n", novfs_current_mnt);
|
|
}
|
|
}
|
|
DbgPrint("%s", buf);
|
|
@@ -69,9 +67,7 @@ int novfs_proc_init(void)
|
|
|
|
if (Novfs_Control) {
|
|
Novfs_Control->size = 0;
|
|
- memcpy(&novfs_daemon_proc_fops,
|
|
- Novfs_Control->proc_fops,
|
|
- sizeof(struct file_operations));
|
|
+ memcpy(&novfs_daemon_proc_fops, Novfs_Control->proc_fops, sizeof(struct file_operations));
|
|
|
|
/*
|
|
* Setup our functions
|
|
@@ -96,8 +92,7 @@ int novfs_proc_init(void)
|
|
/*
|
|
* Setup our file functions
|
|
*/
|
|
- memcpy(&novfs_lib_proc_fops, Novfs_Library->proc_fops,
|
|
- sizeof(struct file_operations));
|
|
+ memcpy(&novfs_lib_proc_fops, Novfs_Library->proc_fops, sizeof(struct file_operations));
|
|
novfs_lib_proc_fops.owner = THIS_MODULE;
|
|
novfs_lib_proc_fops.open = novfs_daemon_lib_open;
|
|
novfs_lib_proc_fops.release = novfs_daemon_lib_close;
|
|
@@ -112,9 +107,7 @@ int novfs_proc_init(void)
|
|
return (-ENOENT);
|
|
}
|
|
|
|
- Novfs_Version =
|
|
- create_proc_read_entry("Version", 0444, novfs_procfs_dir,
|
|
- Novfs_Get_Version, NULL);
|
|
+ Novfs_Version = create_proc_read_entry("Version", 0444, novfs_procfs_dir, Novfs_Get_Version, NULL);
|
|
if (Novfs_Version) {
|
|
Novfs_Version->size = 0;
|
|
} else {
|
|
@@ -141,8 +134,7 @@ void novfs_proc_exit(void)
|
|
DbgPrint("remove_proc_entry(Library, NULL)\n");
|
|
remove_proc_entry("Library", novfs_procfs_dir);
|
|
|
|
- DbgPrint("remove_proc_entry(%s, NULL)\n",
|
|
- MODULE_NAME);
|
|
+ DbgPrint("remove_proc_entry(%s, NULL)\n", MODULE_NAME);
|
|
remove_proc_entry(MODULE_NAME, NULL);
|
|
|
|
DbgPrint("done\n");
|
|
--- a/fs/novfs/profile.c
|
|
+++ b/fs/novfs/profile.c
|
|
@@ -62,7 +62,7 @@ static struct proc_dir_entry *inode_file
|
|
|
|
static DECLARE_MUTEX(LocalPrint_lock);
|
|
|
|
-static ssize_t User_proc_write_DbgBuffer(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos)
|
|
+static ssize_t User_proc_write_DbgBuffer(struct file *file, const char __user * buf, size_t nbytes, loff_t * ppos)
|
|
{
|
|
ssize_t retval = nbytes;
|
|
u_char *lbuf, *p;
|
|
@@ -101,8 +101,7 @@ static ssize_t User_proc_write_DbgBuffer
|
|
} else if (!strcmp("novfsd", lbuf)) {
|
|
novfs_daemon_debug_cmd_send(p);
|
|
} else if (!strcmp("file_update_timeout", lbuf)) {
|
|
- novfs_update_timeout =
|
|
- simple_strtoul(p, NULL, 0);
|
|
+ novfs_update_timeout = simple_strtoul(p, NULL, 0);
|
|
} else if (!strcmp("cache", lbuf)) {
|
|
if (!strcmp("on", p)) {
|
|
novfs_page_cache = 1;
|
|
@@ -134,9 +133,7 @@ static ssize_t User_proc_read_DbgBuffer(
|
|
count = nbytes;
|
|
}
|
|
|
|
- count -=
|
|
- copy_to_user(buf, &DbgPrintBuffer[DbgPrintBufferReadOffset],
|
|
- count);
|
|
+ count -= copy_to_user(buf, &DbgPrintBuffer[DbgPrintBufferReadOffset], count);
|
|
|
|
if (count == 0) {
|
|
if (retval == 0)
|
|
@@ -144,8 +141,7 @@ static ssize_t User_proc_read_DbgBuffer(
|
|
} else {
|
|
DbgPrintBufferReadOffset += count;
|
|
if (DbgPrintBufferReadOffset >= DbgPrintBufferOffset) {
|
|
- DbgPrintBufferOffset =
|
|
- DbgPrintBufferReadOffset = 0;
|
|
+ DbgPrintBufferOffset = DbgPrintBufferReadOffset = 0;
|
|
}
|
|
retval = count;
|
|
}
|
|
@@ -158,7 +154,8 @@ static int proc_read_DbgBuffer(char *pag
|
|
{
|
|
int len;
|
|
|
|
- printk(KERN_ALERT "proc_read_DbgBuffer: off=%ld count=%d DbgPrintBufferOffset=%lu DbgPrintBufferReadOffset=%lu\n", off, count, DbgPrintBufferOffset, DbgPrintBufferReadOffset);
|
|
+ printk(KERN_ALERT "proc_read_DbgBuffer: off=%ld count=%d DbgPrintBufferOffset=%lu DbgPrintBufferReadOffset=%lu\n", off,
|
|
+ count, DbgPrintBufferOffset, DbgPrintBufferReadOffset);
|
|
|
|
len = DbgPrintBufferOffset - DbgPrintBufferReadOffset;
|
|
|
|
@@ -187,9 +184,7 @@ static int LocalPrint(char *Fmt, ...)
|
|
|
|
if (DbgPrintBuffer) {
|
|
va_start(args, Fmt);
|
|
- len += vsnprintf(DbgPrintBuffer + DbgPrintBufferOffset,
|
|
- DbgPrintBufferSize - DbgPrintBufferOffset,
|
|
- Fmt, args);
|
|
+ len += vsnprintf(DbgPrintBuffer + DbgPrintBufferOffset, DbgPrintBufferSize - DbgPrintBufferOffset, Fmt, args);
|
|
DbgPrintBufferOffset += len;
|
|
}
|
|
|
|
@@ -209,8 +204,7 @@ int ___DbgPrint(const char *site, const
|
|
if (buf) {
|
|
va_start(args, Fmt);
|
|
len = snprintf(buf, DBG_BUFFER_SIZE, "[%d] %s ", current->pid, site);
|
|
- len += vsnprintf(buf + len, DBG_BUFFER_SIZE - len, Fmt,
|
|
- args);
|
|
+ len += vsnprintf(buf + len, DBG_BUFFER_SIZE - len, Fmt, args);
|
|
if (-1 == len) {
|
|
len = DBG_BUFFER_SIZE - 1;
|
|
buf[len] = '\0';
|
|
@@ -226,25 +220,18 @@ int ___DbgPrint(const char *site, const
|
|
}
|
|
|
|
if (DbgPrintBuffer && DbgPrintOn) {
|
|
- if ((DbgPrintBufferOffset + len) >
|
|
- DbgPrintBufferSize) {
|
|
+ if ((DbgPrintBufferOffset + len) > DbgPrintBufferSize) {
|
|
offset = DbgPrintBufferOffset;
|
|
DbgPrintBufferOffset = 0;
|
|
- memset(&DbgPrintBuffer[offset],
|
|
- 0,
|
|
- DbgPrintBufferSize -
|
|
- offset);
|
|
+ memset(&DbgPrintBuffer[offset], 0, DbgPrintBufferSize - offset);
|
|
}
|
|
|
|
mb();
|
|
|
|
- if ((DbgPrintBufferOffset + len) <
|
|
- DbgPrintBufferSize) {
|
|
+ if ((DbgPrintBufferOffset + len) < DbgPrintBufferSize) {
|
|
DbgPrintBufferOffset += len;
|
|
- offset =
|
|
- DbgPrintBufferOffset - len;
|
|
- memcpy(&DbgPrintBuffer[offset],
|
|
- buf, len + 1);
|
|
+ offset = DbgPrintBufferOffset - len;
|
|
+ memcpy(&DbgPrintBuffer[offset], buf, len + 1);
|
|
}
|
|
}
|
|
}
|
|
@@ -317,8 +304,7 @@ static void NovfsGregorianDay(struct loc
|
|
int leapsToDate;
|
|
int lastYear;
|
|
int day;
|
|
- int MonthOffset[] =
|
|
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
|
+ int MonthOffset[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
|
|
|
lastYear = tm->tm_year - 1;
|
|
|
|
@@ -333,9 +319,7 @@ static void NovfsGregorianDay(struct loc
|
|
*
|
|
* e.g. 1904 was a leap year, 1900 was not, 1996 is, and 2000 will be
|
|
*/
|
|
- if ((tm->tm_year % 4 == 0) &&
|
|
- ((tm->tm_year % 100 != 0) || (tm->tm_year % 400 == 0)) &&
|
|
- (tm->tm_mon > 2)) {
|
|
+ if ((tm->tm_year % 4 == 0) && ((tm->tm_year % 100 != 0) || (tm->tm_year % 400 == 0)) && (tm->tm_mon > 2)) {
|
|
/*
|
|
* We are past Feb. 29 in a leap year
|
|
*/
|
|
@@ -344,8 +328,7 @@ static void NovfsGregorianDay(struct loc
|
|
day = 0;
|
|
}
|
|
|
|
- day += lastYear * 365 + leapsToDate + MonthOffset[tm->tm_mon - 1] +
|
|
- tm->tm_mday;
|
|
+ day += lastYear * 365 + leapsToDate + MonthOffset[tm->tm_mon - 1] + tm->tm_mday;
|
|
|
|
tm->tm_wday = day % 7;
|
|
}
|
|
@@ -388,17 +371,15 @@ static void private_to_tm(int tim, struc
|
|
char *ctime_r(time_t * clock, char *buf)
|
|
{
|
|
struct local_rtc_time tm;
|
|
- static char *DAYOFWEEK[] =
|
|
- { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
|
- static char *MONTHOFYEAR[] =
|
|
- { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
|
|
-"Oct", "Nov", "Dec" };
|
|
+ static char *DAYOFWEEK[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
|
+ static char *MONTHOFYEAR[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
|
|
+ "Oct", "Nov", "Dec"
|
|
+ };
|
|
|
|
private_to_tm(*clock, &tm);
|
|
|
|
sprintf(buf, "%s %s %d %d:%02d:%02d %d", DAYOFWEEK[tm.tm_wday],
|
|
- MONTHOFYEAR[tm.tm_mon - 1], tm.tm_mday, tm.tm_hour, tm.tm_min,
|
|
- tm.tm_sec, tm.tm_year);
|
|
+ MONTHOFYEAR[tm.tm_mon - 1], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year);
|
|
return (buf);
|
|
}
|
|
|
|
@@ -421,8 +402,7 @@ static void dump(struct dentry *parent,
|
|
}
|
|
|
|
if (parent) {
|
|
- pfunc("starting 0x%p %.*s\n", parent, parent->d_name.len,
|
|
- parent->d_name.name);
|
|
+ pfunc("starting 0x%p %.*s\n", parent, parent->d_name.len, parent->d_name.name);
|
|
if (parent->d_subdirs.next == &parent->d_subdirs) {
|
|
pfunc("No children...\n");
|
|
} else {
|
|
@@ -434,18 +414,13 @@ static void dump(struct dentry *parent,
|
|
while (l) {
|
|
p = l->dentry->d_subdirs.next;
|
|
while (p != &l->dentry->d_subdirs) {
|
|
- d = list_entry(p, struct dentry,
|
|
- d_u.d_child);
|
|
+ d = list_entry(p, struct dentry, d_u.d_child);
|
|
p = p->next;
|
|
|
|
- if (d->d_subdirs.next !=
|
|
- &d->d_subdirs) {
|
|
- n = kmalloc(sizeof
|
|
- (*n),
|
|
- GFP_KERNEL);
|
|
+ if (d->d_subdirs.next != &d->d_subdirs) {
|
|
+ n = kmalloc(sizeof(*n), GFP_KERNEL);
|
|
if (n) {
|
|
- n->next =
|
|
- l->next;
|
|
+ n->next = l->next;
|
|
l->next = n;
|
|
n->dentry = d;
|
|
}
|
|
@@ -461,21 +436,11 @@ static void dump(struct dentry *parent,
|
|
" d_subdirs: 0x%p\n"
|
|
" d_inode: 0x%p\n",
|
|
d, path,
|
|
- d->d_name.
|
|
- len,
|
|
- d->d_name.
|
|
- name,
|
|
- d->
|
|
- d_parent,
|
|
+ d->d_name.len,
|
|
+ d->d_name.name,
|
|
+ d->d_parent,
|
|
atomic_read
|
|
- (&d->
|
|
- d_count),
|
|
- d->d_flags,
|
|
- d->
|
|
- d_subdirs.
|
|
- next,
|
|
- d->
|
|
- d_inode);
|
|
+ (&d->d_count), d->d_flags, d->d_subdirs.next, d->d_inode);
|
|
}
|
|
}
|
|
}
|
|
@@ -484,22 +449,15 @@ static void dump(struct dentry *parent,
|
|
l = start;
|
|
while (l) {
|
|
d = l->dentry;
|
|
- path =
|
|
- novfs_scope_dget_path(d, buf,
|
|
- PATH_LENGTH_BUFFER,
|
|
- 1);
|
|
+ path = novfs_scope_dget_path(d, buf, PATH_LENGTH_BUFFER, 1);
|
|
if (path) {
|
|
sd = " (None)";
|
|
- if (&d->d_subdirs !=
|
|
- d->d_subdirs.next) {
|
|
+ if (&d->d_subdirs != d->d_subdirs.next) {
|
|
sd = "";
|
|
}
|
|
inode_number[0] = '\0';
|
|
if (d->d_inode) {
|
|
- sprintf(inode_number,
|
|
- " (%lu)",
|
|
- d->d_inode->
|
|
- i_ino);
|
|
+ sprintf(inode_number, " (%lu)", d->d_inode->i_ino);
|
|
}
|
|
pfunc("0x%p %s\n"
|
|
" d_parent: 0x%p\n"
|
|
@@ -509,9 +467,7 @@ static void dump(struct dentry *parent,
|
|
" d_inode: 0x%p%s\n",
|
|
d, path, d->d_parent,
|
|
atomic_read(&d->d_count),
|
|
- d->d_flags,
|
|
- d->d_subdirs.next, sd,
|
|
- d->d_inode, inode_number);
|
|
+ d->d_flags, d->d_subdirs.next, sd, d->d_inode, inode_number);
|
|
}
|
|
|
|
n = l;
|
|
@@ -550,8 +506,7 @@ static ssize_t common_read(char *buf, si
|
|
|
|
}
|
|
|
|
-static ssize_t novfs_profile_read_inode(struct file * file, char *buf, size_t len,
|
|
- loff_t * off)
|
|
+static ssize_t novfs_profile_read_inode(struct file *file, char *buf, size_t len, loff_t * off)
|
|
{
|
|
ssize_t retval = 0;
|
|
unsigned long offset = *off;
|
|
@@ -566,7 +521,6 @@ static ssize_t novfs_profile_read_inode(
|
|
novfs_dump_inode(LocalPrint);
|
|
}
|
|
|
|
-
|
|
retval = common_read(buf, len, off);
|
|
|
|
if (0 == retval) {
|
|
@@ -580,8 +534,7 @@ static ssize_t novfs_profile_read_inode(
|
|
|
|
}
|
|
|
|
-static ssize_t novfs_profile_dentry_read(struct file * file, char *buf, size_t len,
|
|
- loff_t * off)
|
|
+static ssize_t novfs_profile_dentry_read(struct file *file, char *buf, size_t len, loff_t * off)
|
|
{
|
|
ssize_t retval = 0;
|
|
unsigned long offset = *off;
|
|
@@ -630,18 +583,12 @@ void novfs_profile_init()
|
|
dbg_dir = proc_mkdir(MODULE_NAME, NULL);
|
|
|
|
if (dbg_dir) {
|
|
- dbg_file = create_proc_read_entry("Debug",
|
|
- 0600,
|
|
- dbg_dir,
|
|
- proc_read_DbgBuffer, NULL);
|
|
+ dbg_file = create_proc_read_entry("Debug", 0600, dbg_dir, proc_read_DbgBuffer, NULL);
|
|
if (dbg_file) {
|
|
dbg_file->size = DBGBUFFERSIZE;
|
|
- memcpy(&Dbg_proc_file_operations, dbg_file->proc_fops,
|
|
- sizeof(struct file_operations));
|
|
- Dbg_proc_file_operations.read =
|
|
- User_proc_read_DbgBuffer;
|
|
- Dbg_proc_file_operations.write =
|
|
- User_proc_write_DbgBuffer;
|
|
+ memcpy(&Dbg_proc_file_operations, dbg_file->proc_fops, sizeof(struct file_operations));
|
|
+ Dbg_proc_file_operations.read = User_proc_read_DbgBuffer;
|
|
+ Dbg_proc_file_operations.write = User_proc_write_DbgBuffer;
|
|
dbg_file->proc_fops = &Dbg_proc_file_operations;
|
|
} else {
|
|
remove_proc_entry(MODULE_NAME, NULL);
|
|
@@ -655,22 +602,16 @@ void novfs_profile_init()
|
|
inode_file = create_proc_entry("inode", 0600, dbg_dir);
|
|
if (inode_file) {
|
|
inode_file->size = 0;
|
|
- memcpy(&inode_proc_file_ops,
|
|
- inode_file->proc_fops,
|
|
- sizeof(struct file_operations));
|
|
+ memcpy(&inode_proc_file_ops, inode_file->proc_fops, sizeof(struct file_operations));
|
|
inode_proc_file_ops.owner = THIS_MODULE;
|
|
- inode_proc_file_ops.read =
|
|
- novfs_profile_read_inode;
|
|
+ inode_proc_file_ops.read = novfs_profile_read_inode;
|
|
inode_file->proc_fops = &inode_proc_file_ops;
|
|
}
|
|
|
|
- dentry_file = create_proc_entry("dentry",
|
|
- 0600, dbg_dir);
|
|
+ dentry_file = create_proc_entry("dentry", 0600, dbg_dir);
|
|
if (dentry_file) {
|
|
dentry_file->size = 0;
|
|
- memcpy(&dentry_proc_file_ops,
|
|
- dentry_file->proc_fops,
|
|
- sizeof(struct file_operations));
|
|
+ memcpy(&dentry_proc_file_ops, dentry_file->proc_fops, sizeof(struct file_operations));
|
|
dentry_proc_file_ops.owner = THIS_MODULE;
|
|
dentry_proc_file_ops.read = novfs_profile_dentry_read;
|
|
dentry_file->proc_fops = &dentry_proc_file_ops;
|
|
@@ -686,19 +627,14 @@ void novfs_profile_init()
|
|
void novfs_profile_exit(void)
|
|
{
|
|
if (dbg_file)
|
|
- DbgPrint("Calling remove_proc_entry(Debug, NULL)\n"),
|
|
- remove_proc_entry("Debug", dbg_dir);
|
|
+ DbgPrint("Calling remove_proc_entry(Debug, NULL)\n"), remove_proc_entry("Debug", dbg_dir);
|
|
if (inode_file)
|
|
- DbgPrint("Calling remove_proc_entry(inode, NULL)\n"),
|
|
- remove_proc_entry("inode", dbg_dir);
|
|
+ DbgPrint("Calling remove_proc_entry(inode, NULL)\n"), remove_proc_entry("inode", dbg_dir);
|
|
if (dentry_file)
|
|
- DbgPrint("Calling remove_proc_entry(dentry, NULL)\n"),
|
|
- remove_proc_entry("dentry", dbg_dir);
|
|
+ DbgPrint("Calling remove_proc_entry(dentry, NULL)\n"), remove_proc_entry("dentry", dbg_dir);
|
|
|
|
if (dbg_dir && (dbg_dir != novfs_procfs_dir)) {
|
|
DbgPrint("Calling remove_proc_entry(%s, NULL)\n", MODULE_NAME);
|
|
remove_proc_entry(MODULE_NAME, NULL);
|
|
}
|
|
}
|
|
-
|
|
-
|
|
--- a/fs/novfs/scope.c
|
|
+++ b/fs/novfs/scope.c
|
|
@@ -33,7 +33,6 @@
|
|
#define CLEANUP_INTERVAL 10
|
|
#define MAX_USERNAME_LENGTH 32
|
|
|
|
-
|
|
static struct list_head Scope_List;
|
|
static struct semaphore Scope_Lock;
|
|
static struct semaphore Scope_Thread_Delay;
|
|
@@ -41,16 +40,14 @@ static int Scope_Thread_Terminate = 0;
|
|
static struct timer_list Scope_Timer;
|
|
static unsigned int Scope_Hash_Val = 1;
|
|
|
|
-static struct novfs_scope_list *Scope_Search4Scope(struct novfs_schandle Id,
|
|
- int Session, int Locked)
|
|
+static struct novfs_scope_list *Scope_Search4Scope(struct novfs_schandle Id, int Session, int Locked)
|
|
{
|
|
struct novfs_scope_list *scope, *rscope = NULL;
|
|
struct novfs_schandle cur_scope;
|
|
struct list_head *sl;
|
|
int offset;
|
|
|
|
- DbgPrint("Scope_Search4Scope: 0x%p:%p 0x%x 0x%x\n", Id.hTypeId, Id.hId,
|
|
- Session, Locked);
|
|
+ DbgPrint("Scope_Search4Scope: 0x%p:%p 0x%x 0x%x\n", Id.hTypeId, Id.hId, Session, Locked);
|
|
|
|
if (Session)
|
|
offset = offsetof(struct novfs_scope_list, SessionId);
|
|
@@ -66,7 +63,7 @@ static struct novfs_scope_list *Scope_Se
|
|
while (sl != &Scope_List) {
|
|
scope = list_entry(sl, struct novfs_scope_list, ScopeList);
|
|
|
|
- cur_scope = *(struct novfs_schandle *) ((char *)scope + offset);
|
|
+ cur_scope = *(struct novfs_schandle *)((char *)scope + offset);
|
|
if (SC_EQUAL(Id, cur_scope)) {
|
|
rscope = scope;
|
|
break;
|
|
@@ -92,8 +89,7 @@ static struct novfs_scope_list *Scope_Fi
|
|
|
|
task = current;
|
|
|
|
- DbgPrint("Scope_Find_Scope: %d %d %d %d\n", current_uid(),
|
|
- current_euid(), current_suid(), current_fsuid());
|
|
+ DbgPrint("Scope_Find_Scope: %d %d %d %d\n", current_uid(), current_euid(), current_suid(), current_fsuid());
|
|
|
|
//scopeId = task->euid;
|
|
UID_TO_SCHANDLE(scopeId, current_euid());
|
|
@@ -113,16 +109,11 @@ static struct novfs_scope_list *Scope_Fi
|
|
|
|
if (!novfs_daemon_create_sessionId(&scope->SessionId)) {
|
|
DbgPrint("Scope_Find_Scope2: %d %d %d %d\n",
|
|
- current_uid(), current_euid(),
|
|
- current_suid(), current_fsuid());
|
|
- memset(scope->ScopeUserName, 0,
|
|
- sizeof(scope->ScopeUserName));
|
|
+ current_uid(), current_euid(), current_suid(), current_fsuid());
|
|
+ memset(scope->ScopeUserName, 0, sizeof(scope->ScopeUserName));
|
|
scope->ScopeUserNameLength = 0;
|
|
- novfs_daemon_getpwuid(current_euid(),
|
|
- sizeof(scope->ScopeUserName),
|
|
- scope->ScopeUserName);
|
|
- scope->ScopeUserNameLength =
|
|
- strlen(scope->ScopeUserName);
|
|
+ novfs_daemon_getpwuid(current_euid(), sizeof(scope->ScopeUserName), scope->ScopeUserName);
|
|
+ scope->ScopeUserNameLength = strlen(scope->ScopeUserName);
|
|
addscope = 1;
|
|
}
|
|
|
|
@@ -141,27 +132,20 @@ static struct novfs_scope_list *Scope_Fi
|
|
scope->SessionId.hTypeId, scope->SessionId.hId,
|
|
scope->ScopePid,
|
|
scope->ScopeTask,
|
|
- scope->ScopeHash,
|
|
- scope->ScopeUid,
|
|
- scope->ScopeUserNameLength,
|
|
- scope->ScopeUserName);
|
|
+ scope->ScopeHash, scope->ScopeUid, scope->ScopeUserNameLength, scope->ScopeUserName);
|
|
|
|
if (SC_PRESENT(scope->SessionId)) {
|
|
down(&Scope_Lock);
|
|
- pscope =
|
|
- Scope_Search4Scope(scopeId, 0, 1);
|
|
+ pscope = Scope_Search4Scope(scopeId, 0, 1);
|
|
|
|
if (!pscope) {
|
|
- list_add(&scope->ScopeList,
|
|
- &Scope_List);
|
|
+ list_add(&scope->ScopeList, &Scope_List);
|
|
}
|
|
up(&Scope_Lock);
|
|
|
|
if (pscope) {
|
|
- printk
|
|
- ("<6>Scope_Find_Scope scope not added because it was already there...\n");
|
|
- novfs_daemon_destroy_sessionId(scope->
|
|
- SessionId);
|
|
+ printk("<6>Scope_Find_Scope scope not added because it was already there...\n");
|
|
+ novfs_daemon_destroy_sessionId(scope->SessionId);
|
|
kfree(scope);
|
|
scope = pscope;
|
|
addscope = 0;
|
|
@@ -170,7 +154,7 @@ static struct novfs_scope_list *Scope_Fi
|
|
kfree(scope);
|
|
scope = NULL;
|
|
}
|
|
-
|
|
+
|
|
if (scope && addscope)
|
|
novfs_add_to_root(scope->ScopeUserName);
|
|
}
|
|
@@ -206,7 +190,7 @@ static int Scope_Validate_Scope(struct n
|
|
return (retVal);
|
|
}
|
|
|
|
-uid_t novfs_scope_get_uid(struct novfs_scope_list *scope)
|
|
+uid_t novfs_scope_get_uid(struct novfs_scope_list * scope)
|
|
{
|
|
uid_t uid = 0;
|
|
if (!scope)
|
|
@@ -231,7 +215,7 @@ char *novfs_scope_get_username(void)
|
|
}
|
|
|
|
struct novfs_schandle novfs_scope_get_sessionId(struct novfs_scope_list
|
|
- *Scope)
|
|
+ *Scope)
|
|
{
|
|
struct novfs_schandle sessionId;
|
|
DbgPrint("Scope_Get_SessionId: 0x%p\n", Scope);
|
|
@@ -241,12 +225,11 @@ struct novfs_schandle novfs_scope_get_se
|
|
|
|
if (Scope && Scope_Validate_Scope(Scope))
|
|
sessionId = Scope->SessionId;
|
|
- DbgPrint("Scope_Get_SessionId: return 0x%p:%p\n", sessionId.hTypeId,
|
|
- sessionId.hId);
|
|
+ DbgPrint("Scope_Get_SessionId: return 0x%p:%p\n", sessionId.hTypeId, sessionId.hId);
|
|
return (sessionId);
|
|
}
|
|
|
|
-struct novfs_scope_list *novfs_get_scope_from_name(struct qstr * Name)
|
|
+struct novfs_scope_list *novfs_get_scope_from_name(struct qstr *Name)
|
|
{
|
|
struct novfs_scope_list *scope, *rscope = NULL;
|
|
struct list_head *sl;
|
|
@@ -259,9 +242,7 @@ struct novfs_scope_list *novfs_get_scope
|
|
while (sl != &Scope_List) {
|
|
scope = list_entry(sl, struct novfs_scope_list, ScopeList);
|
|
|
|
- if ((Name->len == scope->ScopeUserNameLength) &&
|
|
- (0 == strncmp(scope->ScopeUserName, Name->name, Name->len)))
|
|
- {
|
|
+ if ((Name->len == scope->ScopeUserNameLength) && (0 == strncmp(scope->ScopeUserName, Name->name, Name->len))) {
|
|
rscope = scope;
|
|
break;
|
|
}
|
|
@@ -274,8 +255,7 @@ struct novfs_scope_list *novfs_get_scope
|
|
return (rscope);
|
|
}
|
|
|
|
-int novfs_scope_set_userspace(uint64_t * TotalSize, uint64_t * Free,
|
|
- uint64_t * TotalEnties, uint64_t * FreeEnties)
|
|
+int novfs_scope_set_userspace(uint64_t * TotalSize, uint64_t * Free, uint64_t * TotalEnties, uint64_t * FreeEnties)
|
|
{
|
|
struct novfs_scope_list *scope;
|
|
int retVal = 0;
|
|
@@ -296,8 +276,7 @@ int novfs_scope_set_userspace(uint64_t *
|
|
return (retVal);
|
|
}
|
|
|
|
-int novfs_scope_get_userspace(uint64_t * TotalSize, uint64_t * Free,
|
|
- uint64_t * TotalEnties, uint64_t * FreeEnties)
|
|
+int novfs_scope_get_userspace(uint64_t * TotalSize, uint64_t * Free, uint64_t * TotalEnties, uint64_t * FreeEnties)
|
|
{
|
|
struct novfs_scope_list *scope;
|
|
int retVal = 0;
|
|
@@ -309,8 +288,7 @@ int novfs_scope_get_userspace(uint64_t *
|
|
td = fd = te = fe = 0;
|
|
if (scope) {
|
|
|
|
- retVal =
|
|
- novfs_daemon_get_userspace(scope->SessionId, &td, &fd, &te, &fe);
|
|
+ retVal = novfs_daemon_get_userspace(scope->SessionId, &td, &fd, &te, &fe);
|
|
|
|
scope->ScopeUSize = td;
|
|
scope->ScopeUFree = fd;
|
|
@@ -330,7 +308,7 @@ int novfs_scope_get_userspace(uint64_t *
|
|
return (retVal);
|
|
}
|
|
|
|
-struct novfs_scope_list *novfs_get_scope(struct dentry * Dentry)
|
|
+struct novfs_scope_list *novfs_get_scope(struct dentry *Dentry)
|
|
{
|
|
struct novfs_scope_list *scope = NULL;
|
|
char *buf, *path, *cp;
|
|
@@ -404,8 +382,7 @@ char *novfs_get_scopeusers(void)
|
|
while ((sl != &Scope_List) && (cp < ep)) {
|
|
scope = list_entry(sl, struct novfs_scope_list, ScopeList);
|
|
|
|
- DbgPrint("Scope_Get_ScopeUsers found 0x%p %s\n",
|
|
- scope, scope->ScopeUserName);
|
|
+ DbgPrint("Scope_Get_ScopeUsers found 0x%p %s\n", scope, scope->ScopeUserName);
|
|
|
|
cp = add_to_list(scope->ScopeUserName, cp, ep);
|
|
|
|
@@ -486,8 +463,7 @@ static int Scope_Cleanup_Thread(void *Ar
|
|
|
|
if (!rscope) {
|
|
list_move(&scope->ScopeList, &cleanup);
|
|
- DbgPrint("Scope_Cleanup_Thread: Scope=0x%p\n",
|
|
- rscope);
|
|
+ DbgPrint("Scope_Cleanup_Thread: Scope=0x%p\n", rscope);
|
|
}
|
|
}
|
|
|
|
@@ -509,10 +485,7 @@ static int Scope_Cleanup_Thread(void *Ar
|
|
scope,
|
|
scope->ScopeId,
|
|
scope->SessionId,
|
|
- scope->ScopePid,
|
|
- scope->ScopeTask,
|
|
- scope->ScopeHash,
|
|
- scope->ScopeUid, scope->ScopeUserName);
|
|
+ scope->ScopePid, scope->ScopeTask, scope->ScopeHash, scope->ScopeUid, scope->ScopeUserName);
|
|
if (!Scope_Search4Scope(scope->SessionId, 1, 0)) {
|
|
novfs_remove_from_root(scope->ScopeUserName);
|
|
novfs_daemon_destroy_sessionId(scope->SessionId);
|
|
@@ -569,10 +542,7 @@ void novfs_scope_cleanup(void)
|
|
scope,
|
|
scope->ScopeId,
|
|
scope->SessionId,
|
|
- scope->ScopePid,
|
|
- scope->ScopeTask,
|
|
- scope->ScopeHash,
|
|
- scope->ScopeUid, scope->ScopeUserName);
|
|
+ scope->ScopePid, scope->ScopeTask, scope->ScopeHash, scope->ScopeUid, scope->ScopeUserName);
|
|
if (!Scope_Search4Scope(scope->SessionId, 1, 1)) {
|
|
novfs_remove_from_root(scope->ScopeUserName);
|
|
novfs_daemon_destroy_sessionId(scope->SessionId);
|
|
@@ -587,8 +557,7 @@ void novfs_scope_cleanup(void)
|
|
/*
|
|
* Walks the dentry chain building a path.
|
|
*/
|
|
-char *novfs_scope_dget_path(struct dentry *Dentry, char *Buf, unsigned int Buflen,
|
|
- int Flags)
|
|
+char *novfs_scope_dget_path(struct dentry *Dentry, char *Buf, unsigned int Buflen, int Flags)
|
|
{
|
|
char *retval = &Buf[Buflen];
|
|
struct dentry *p = Dentry;
|
|
@@ -654,5 +623,3 @@ void novfs_scope_exit(void)
|
|
printk(KERN_INFO "Scope_Uninit: Exit\n");
|
|
|
|
}
|
|
-
|
|
-
|
|
--- a/fs/novfs/vfs.h
|
|
+++ b/fs/novfs/vfs.h
|
|
@@ -23,11 +23,10 @@
|
|
|
|
#include "nwcapi.h"
|
|
|
|
-
|
|
#ifndef XTIER_SCHANDLE
|
|
struct novfs_schandle {
|
|
- void * hTypeId;
|
|
- void * hId;
|
|
+ void *hTypeId;
|
|
+ void *hId;
|
|
|
|
};
|
|
|
|
@@ -46,7 +45,6 @@ struct novfs_schandle {
|
|
#define XTIER_SCHANDLE
|
|
#endif
|
|
|
|
-
|
|
/*===[ Manifest constants ]===============================================*/
|
|
#define NOVFS_MAGIC 0x4e574653
|
|
#define MODULE_NAME "novfs"
|
|
@@ -191,15 +189,14 @@ struct novfs_data_list {
|
|
int rwflag;
|
|
};
|
|
|
|
-
|
|
extern char *ctime_r(time_t * clock, char *buf);
|
|
|
|
/*
|
|
* Converts a HANDLE to a u32 type.
|
|
*/
|
|
-static inline u32 HandletoUint32(void * h)
|
|
+static inline u32 HandletoUint32(void *h)
|
|
{
|
|
- return (u32) ((unsigned long) h);
|
|
+ return (u32) ((unsigned long)h);
|
|
}
|
|
|
|
/*
|
|
@@ -207,7 +204,7 @@ static inline u32 HandletoUint32(void *
|
|
*/
|
|
static inline void *Uint32toHandle(u32 ui32)
|
|
{
|
|
- return ((void *) (unsigned long) ui32);
|
|
+ return ((void *)(unsigned long)ui32);
|
|
}
|
|
|
|
/* Global variables */
|
|
@@ -219,7 +216,6 @@ extern int novfs_page_cache;
|
|
extern char *novfs_current_mnt;
|
|
extern int novfs_max_iosize;
|
|
|
|
-
|
|
/* Global functions */
|
|
extern int novfs_remove_from_root(char *);
|
|
extern void novfs_dump_inode(void *pf);
|
|
@@ -227,9 +223,9 @@ extern void novfs_dump_inode(void *pf);
|
|
extern void novfs_dump(int size, void *dumpptr);
|
|
|
|
extern int Queue_Daemon_Command(void *request, unsigned long reqlen, void *data,
|
|
- int dlen, void **reply, unsigned long * replen,
|
|
- int interruptible);
|
|
-extern int novfs_do_login(struct ncl_string * Server, struct ncl_string* Username, struct ncl_string * Password, void **lgnId, struct novfs_schandle *Session);
|
|
+ int dlen, void **reply, unsigned long *replen, int interruptible);
|
|
+extern int novfs_do_login(struct ncl_string *Server, struct ncl_string *Username, struct ncl_string *Password, void **lgnId,
|
|
+ struct novfs_schandle *Session);
|
|
|
|
extern int novfs_proc_init(void);
|
|
extern void novfs_proc_exit(void);
|
|
@@ -241,111 +237,71 @@ extern void novfs_daemon_queue_init(void
|
|
extern void novfs_daemon_queue_exit(void);
|
|
extern int novfs_daemon_logout(struct qstr *Server, struct novfs_schandle *Session);
|
|
extern int novfs_daemon_set_mnt_point(char *Path);
|
|
-extern int novfs_daemon_create_sessionId(struct novfs_schandle * SessionId);
|
|
+extern int novfs_daemon_create_sessionId(struct novfs_schandle *SessionId);
|
|
extern int novfs_daemon_destroy_sessionId(struct novfs_schandle SessionId);
|
|
extern int novfs_daemon_getpwuid(uid_t uid, int unamelen, char *uname);
|
|
extern int novfs_daemon_get_userspace(struct novfs_schandle SessionId,
|
|
- uint64_t * TotalSize, uint64_t * TotalFree,
|
|
- uint64_t * TotalDirectoryEnties,
|
|
- uint64_t * FreeDirectoryEnties);
|
|
+ uint64_t * TotalSize, uint64_t * TotalFree,
|
|
+ uint64_t * TotalDirectoryEnties, uint64_t * FreeDirectoryEnties);
|
|
extern int novfs_daemon_debug_cmd_send(char *Command);
|
|
-extern ssize_t novfs_daemon_recv_reply(struct file *file,
|
|
- const char *buf, size_t nbytes, loff_t * ppos);
|
|
-extern ssize_t novfs_daemon_cmd_send(struct file *file, char *buf,
|
|
- size_t len, loff_t * off);
|
|
-extern int novfs_daemon_ioctl(struct inode *inode, struct file *file,
|
|
- unsigned int cmd, unsigned long arg);
|
|
+extern ssize_t novfs_daemon_recv_reply(struct file *file, const char *buf, size_t nbytes, loff_t * ppos);
|
|
+extern ssize_t novfs_daemon_cmd_send(struct file *file, char *buf, size_t len, loff_t * off);
|
|
+extern int novfs_daemon_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
|
|
extern int novfs_daemon_lib_close(struct inode *inode, struct file *file);
|
|
-extern int novfs_daemon_lib_ioctl(struct inode *inode, struct file *file,
|
|
- unsigned int cmd, unsigned long arg);
|
|
+extern int novfs_daemon_lib_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
|
|
extern int novfs_daemon_lib_open(struct inode *inode, struct file *file);
|
|
-extern ssize_t novfs_daemon_lib_read(struct file *file, char *buf,
|
|
- size_t len, loff_t * off);
|
|
-extern ssize_t novfs_daemon_lib_write(struct file *file, const char *buf,
|
|
- size_t len, loff_t * off);
|
|
-extern loff_t novfs_daemon_lib_llseek(struct file *file, loff_t offset,
|
|
- int origin);
|
|
+extern ssize_t novfs_daemon_lib_read(struct file *file, char *buf, size_t len, loff_t * off);
|
|
+extern ssize_t novfs_daemon_lib_write(struct file *file, const char *buf, size_t len, loff_t * off);
|
|
+extern loff_t novfs_daemon_lib_llseek(struct file *file, loff_t offset, int origin);
|
|
extern int novfs_daemon_open_control(struct inode *Inode, struct file *File);
|
|
extern int novfs_daemon_close_control(struct inode *Inode, struct file *File);
|
|
extern int novfs_daemon_getversion(char *Buf, int Length);
|
|
|
|
-
|
|
/*
|
|
* file.c functions
|
|
*/
|
|
extern int novfs_verify_file(struct qstr *Path, struct novfs_schandle SessionId);
|
|
extern int novfs_get_alltrees(struct dentry *parent);
|
|
-extern int novfs_get_servers(unsigned char **ServerList,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_get_vols(struct qstr *Server,
|
|
- unsigned char **VolumeList, struct novfs_schandle SessionId);
|
|
-extern int novfs_get_file_info(unsigned char *Path,
|
|
- struct novfs_entry_info *Info, struct novfs_schandle SessionId);
|
|
+extern int novfs_get_servers(unsigned char **ServerList, struct novfs_schandle SessionId);
|
|
+extern int novfs_get_vols(struct qstr *Server, unsigned char **VolumeList, struct novfs_schandle SessionId);
|
|
+extern int novfs_get_file_info(unsigned char *Path, struct novfs_entry_info *Info, struct novfs_schandle SessionId);
|
|
extern int novfs_getx_file_info(char *Path, const char *Name,
|
|
- char *buffer, ssize_t buffer_size, ssize_t *dataLen,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_listx_file_info(char *Path, char *buffer,
|
|
- ssize_t buffer_size, ssize_t *dataLen,
|
|
- struct novfs_schandle SessionId);
|
|
+ char *buffer, ssize_t buffer_size, ssize_t * dataLen, struct novfs_schandle SessionId);
|
|
+extern int novfs_listx_file_info(char *Path, char *buffer, ssize_t buffer_size, ssize_t * dataLen, struct novfs_schandle SessionId);
|
|
extern int novfs_setx_file_info(char *Path, const char *Name, const void *Value,
|
|
- unsigned long valueLen,
|
|
- unsigned long *bytesWritten, int flags,
|
|
- struct novfs_schandle SessionId);
|
|
+ unsigned long valueLen, unsigned long *bytesWritten, int flags, struct novfs_schandle SessionId);
|
|
|
|
extern int novfs_get_dir_listex(unsigned char *Path, void **EnumHandle,
|
|
- int *Count, struct novfs_entry_info **Info,
|
|
- struct novfs_schandle SessionId);
|
|
+ int *Count, struct novfs_entry_info **Info, struct novfs_schandle SessionId);
|
|
extern int novfs_open_file(unsigned char *Path, int Flags,
|
|
- struct novfs_entry_info * Info, void **Handle,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_create(unsigned char *Path, int DirectoryFlag,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_close_file(void * Handle, struct novfs_schandle SessionId);
|
|
-extern int novfs_read_file(void * Handle, unsigned char *Buffer,
|
|
- size_t * Bytes, loff_t * Offset,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_read_pages(void * Handle, struct novfs_data_list *DList,
|
|
- int DList_Cnt, size_t * Bytes, loff_t * Offset,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_write_file(void * Handle, unsigned char *Buffer,
|
|
- size_t * Bytes, loff_t * Offset,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_write_page(void * Handle, struct page *Page,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_write_pages(void * Handle, struct novfs_data_list *DList,
|
|
- int DList_Cnt, size_t Bytes, loff_t Offset,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_delete(unsigned char *Path, int DirectoryFlag,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_trunc(unsigned char *Path, int PathLen,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_trunc_ex(void * Handle, loff_t Offset,
|
|
- struct novfs_schandle SessionId);
|
|
+ struct novfs_entry_info *Info, void **Handle, struct novfs_schandle SessionId);
|
|
+extern int novfs_create(unsigned char *Path, int DirectoryFlag, struct novfs_schandle SessionId);
|
|
+extern int novfs_close_file(void *Handle, struct novfs_schandle SessionId);
|
|
+extern int novfs_read_file(void *Handle, unsigned char *Buffer, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId);
|
|
+extern int novfs_read_pages(void *Handle, struct novfs_data_list *DList,
|
|
+ int DList_Cnt, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId);
|
|
+extern int novfs_write_file(void *Handle, unsigned char *Buffer, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId);
|
|
+extern int novfs_write_page(void *Handle, struct page *Page, struct novfs_schandle SessionId);
|
|
+extern int novfs_write_pages(void *Handle, struct novfs_data_list *DList,
|
|
+ int DList_Cnt, size_t Bytes, loff_t Offset, struct novfs_schandle SessionId);
|
|
+extern int novfs_delete(unsigned char *Path, int DirectoryFlag, struct novfs_schandle SessionId);
|
|
+extern int novfs_trunc(unsigned char *Path, int PathLen, struct novfs_schandle SessionId);
|
|
+extern int novfs_trunc_ex(void *Handle, loff_t Offset, struct novfs_schandle SessionId);
|
|
extern int novfs_rename_file(int DirectoryFlag, unsigned char *OldName,
|
|
- int OldLen, unsigned char *NewName, int NewLen,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_set_attr(unsigned char *Path, struct iattr *Attr,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_get_file_cache_flag(unsigned char * Path,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_set_file_lock(struct novfs_schandle SessionId, void * fhandle,
|
|
- unsigned char fl_type, loff_t fl_start,
|
|
- loff_t len);
|
|
-
|
|
-extern struct inode *novfs_get_inode(struct super_block *sb, int mode,
|
|
- int dev, uid_t uid, ino_t ino, struct qstr *name);
|
|
-extern int novfs_read_stream(void * ConnHandle, unsigned char * Handle,
|
|
- unsigned char * Buffer, size_t * Bytes, loff_t * Offset,
|
|
- int User, struct novfs_schandle SessionId);
|
|
-extern int novfs_write_stream(void * ConnHandle, unsigned char * Handle,
|
|
- unsigned char * Buffer, size_t * Bytes, loff_t * Offset,
|
|
- struct novfs_schandle SessionId);
|
|
-extern int novfs_close_stream(void * ConnHandle, unsigned char * Handle,
|
|
- struct novfs_schandle SessionId);
|
|
+ int OldLen, unsigned char *NewName, int NewLen, struct novfs_schandle SessionId);
|
|
+extern int novfs_set_attr(unsigned char *Path, struct iattr *Attr, struct novfs_schandle SessionId);
|
|
+extern int novfs_get_file_cache_flag(unsigned char *Path, struct novfs_schandle SessionId);
|
|
+extern int novfs_set_file_lock(struct novfs_schandle SessionId, void *fhandle, unsigned char fl_type, loff_t fl_start, loff_t len);
|
|
+
|
|
+extern struct inode *novfs_get_inode(struct super_block *sb, int mode, int dev, uid_t uid, ino_t ino, struct qstr *name);
|
|
+extern int novfs_read_stream(void *ConnHandle, unsigned char *Handle,
|
|
+ unsigned char *Buffer, size_t * Bytes, loff_t * Offset, int User, struct novfs_schandle SessionId);
|
|
+extern int novfs_write_stream(void *ConnHandle, unsigned char *Handle,
|
|
+ unsigned char *Buffer, size_t * Bytes, loff_t * Offset, struct novfs_schandle SessionId);
|
|
+extern int novfs_close_stream(void *ConnHandle, unsigned char *Handle, struct novfs_schandle SessionId);
|
|
|
|
extern int novfs_add_to_root(char *);
|
|
-extern int novfs_end_directory_enumerate(void *EnumHandle,
|
|
- struct novfs_schandle SessionId);
|
|
+extern int novfs_end_directory_enumerate(void *EnumHandle, struct novfs_schandle SessionId);
|
|
|
|
/*
|
|
* scope.c functions
|
|
@@ -355,14 +311,11 @@ extern void novfs_scope_exit(void);
|
|
extern void *novfs_scope_lookup(void);
|
|
extern uid_t novfs_scope_get_uid(struct novfs_scope_list *);
|
|
extern struct novfs_schandle novfs_scope_get_sessionId(struct
|
|
- novfs_scope_list *);
|
|
+ novfs_scope_list *);
|
|
extern char *novfs_get_scopeusers(void);
|
|
-extern int novfs_scope_set_userspace(uint64_t * TotalSize, uint64_t * Free,
|
|
- uint64_t * TotalEnties, uint64_t * FreeEnties);
|
|
-extern int novfs_scope_get_userspace(uint64_t * TotalSize, uint64_t * Free,
|
|
- uint64_t * TotalEnties, uint64_t * FreeEnties);
|
|
-extern char *novfs_scope_dget_path(struct dentry *Dentry, char *Buf,
|
|
- unsigned int Buflen, int Flags);
|
|
+extern int novfs_scope_set_userspace(uint64_t * TotalSize, uint64_t * Free, uint64_t * TotalEnties, uint64_t * FreeEnties);
|
|
+extern int novfs_scope_get_userspace(uint64_t * TotalSize, uint64_t * Free, uint64_t * TotalEnties, uint64_t * FreeEnties);
|
|
+extern char *novfs_scope_dget_path(struct dentry *Dentry, char *Buf, unsigned int Buflen, int Flags);
|
|
extern void novfs_scope_cleanup(void);
|
|
extern struct novfs_scope_list *novfs_get_scope_from_name(struct qstr *);
|
|
extern struct novfs_scope_list *novfs_get_scope(struct dentry *);
|
|
@@ -382,73 +335,38 @@ extern void novfs_profile_exit(void);
|
|
/*
|
|
* nwcapi.c functions
|
|
*/
|
|
-extern int novfs_auth_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_conn_close(struct novfs_xplat *pdata,
|
|
- void **Handle, struct novfs_schandle Session);
|
|
-extern int novfs_get_conn_info(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_set_conn_info(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_daemon_ver(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_id_info(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_license_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_login_id(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_logout_id(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_open_conn_by_addr(struct novfs_xplat *pdata,
|
|
- void **Handle, struct novfs_schandle Session);
|
|
-extern int novfs_open_conn_by_name(struct novfs_xplat *pdata,
|
|
- void **Handle, struct novfs_schandle Session);
|
|
-extern int novfs_open_conn_by_ref(struct novfs_xplat *pdata,
|
|
- void **Handle, struct novfs_schandle Session);
|
|
-extern int novfs_query_feature(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_raw_send(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_scan_conn_info(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_sys_conn_close(struct novfs_xplat *pdata,
|
|
- unsigned long *Handle, struct novfs_schandle Session);
|
|
-extern int novfs_unauthenticate(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_unlicense_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_change_auth_key(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_enum_ids(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_default_ctx(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_preferred_DS_tree(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_tree_monitored_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_set_default_ctx(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_set_preferred_DS_tree(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_set_pri_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_pri_conn(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_set_map_drive(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_unmap_drive(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_enum_drives(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_get_bcast_msg(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_set_key_value(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-extern int novfs_verify_key_value(struct novfs_xplat *pdata,
|
|
- struct novfs_schandle Session);
|
|
-
|
|
-
|
|
-#endif /* __NOVFS_H */
|
|
+extern int novfs_auth_conn(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_conn_close(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session);
|
|
+extern int novfs_get_conn_info(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_set_conn_info(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_daemon_ver(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_id_info(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_license_conn(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_login_id(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_logout_id(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_open_conn_by_addr(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session);
|
|
+extern int novfs_open_conn_by_name(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session);
|
|
+extern int novfs_open_conn_by_ref(struct novfs_xplat *pdata, void **Handle, struct novfs_schandle Session);
|
|
+extern int novfs_query_feature(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_raw_send(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_scan_conn_info(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_sys_conn_close(struct novfs_xplat *pdata, unsigned long *Handle, struct novfs_schandle Session);
|
|
+extern int novfs_unauthenticate(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_unlicense_conn(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_change_auth_key(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_enum_ids(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_default_ctx(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_preferred_DS_tree(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_tree_monitored_conn(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_set_default_ctx(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_set_preferred_DS_tree(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_set_pri_conn(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_pri_conn(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_set_map_drive(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_unmap_drive(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_enum_drives(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_get_bcast_msg(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_set_key_value(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
+extern int novfs_verify_key_value(struct novfs_xplat *pdata, struct novfs_schandle Session);
|
|
|
|
+#endif /* __NOVFS_H */
|