s3:smbd: use FNUM_FIELD_INVALID instead of literal -1
authorMichael Adam <obnox@samba.org>
Tue, 12 Jun 2012 15:56:43 +0000 (17:56 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 15 Jun 2012 01:28:13 +0000 (03:28 +0200)
This is in preparation of changing fnum to uint64_t

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/files.c
source3/smbd/posix_acls.c
source3/smbd/smb2_ioctl.c
source3/smbd/trans2.c

index 12ec04cd3b0bec96eafb2ac7763d3ccb35acce81..ada9d67bc497c6d570c173e3aa14d6710c5253d1 100644 (file)
@@ -82,7 +82,7 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
        fsp->fh->ref_count = 1;
        fsp->fh->fd = -1;
 
-       fsp->fnum = -1;
+       fsp->fnum = FNUM_FIELD_INVALID;
        fsp->conn = conn;
 
        DLIST_ADD(sconn->files, fsp);
@@ -581,7 +581,7 @@ static struct files_struct *file_fnum(struct smbd_server_connection *sconn,
        int count=0;
 
        for (fsp=sconn->files; fsp; fsp=fsp->next, count++) {
-               if (fsp->fnum == -1) {
+               if (fsp->fnum == FNUM_FIELD_INVALID) {
                        continue;
                }
 
index e2571ff24828f785aa7819fa4edbf3b175dc7189..9753bfeb6169bbb4e26a35b0419991f6b5ff3fc1 100644 (file)
@@ -4878,7 +4878,7 @@ struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fna
        ZERO_STRUCT( finfo );
        ZERO_STRUCT( fh );
 
-       finfo.fnum = -1;
+       finfo.fnum = FNUM_FIELD_INVALID;
        finfo.conn = conn;
        finfo.fh = &fh;
        finfo.fh->fd = -1;
index 7710a9ebb244e402a0b20b685361bfb9716764a5..db1ef0883e4ef87094251f9a61aa2593ea0dff6a 100644 (file)
@@ -372,7 +372,7 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
        DEBUG(10, ("smbd_smb2_ioctl: ctl_code[0x%08x] %s fnum[%d]\n",
                   (unsigned)in_ctl_code,
                   fsp ? fsp_str_dbg(fsp) : "<no handle>",
-                  fsp ? fsp->fnum : -1));
+                  fsp ? fsp->fnum : FNUM_FIELD_INVALID));
 
        smbreq = smbd_smb2_fake_smb_request(smb2req);
        if (tevent_req_nomem(smbreq, req)) {
index 3787fa972173f087ceb9953c1946a8c399b65c52..b83eb9e1c3db011c68db6936e62481be4433ea06 100644 (file)
@@ -3271,7 +3271,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                        ZERO_STRUCT(quotas);
 
                        fsp.conn = conn;
-                       fsp.fnum = -1;
+                       fsp.fnum = FNUM_FIELD_INVALID;
 
                        /* access check */
                        if (get_current_uid(conn) != 0) {
@@ -4290,7 +4290,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
        }
 
        DEBUG(5,("smbd_do_qfilepathinfo: %s (fnum = %d) level=%d max_data=%u\n",
-                smb_fname_str_dbg(smb_fname), fsp ? fsp->fnum : -1,
+                smb_fname_str_dbg(smb_fname),
+                fsp ? fsp->fnum : FNUM_FIELD_INVALID,
                 info_level, max_data_bytes));
 
        mode = dos_mode(conn, smb_fname);
@@ -5323,7 +5324,8 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
 
        DEBUG(3,("call_trans2qfilepathinfo %s (fnum = %d) level=%d call=%d "
                 "total_data=%d\n", smb_fname_str_dbg(smb_fname),
-                fsp ? fsp->fnum : -1, info_level,tran_call,total_data));
+                fsp ? fsp->fnum : FNUM_FIELD_INVALID,
+                info_level,tran_call,total_data));
 
        /* Pull out any data sent here before we realloc. */
        switch (info_level) {
@@ -7654,7 +7656,8 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
 
        DEBUG(3,("smbd_do_setfilepathinfo: %s (fnum %d) info_level=%d "
                 "totdata=%d\n", smb_fname_str_dbg(smb_fname),
-                fsp ? fsp->fnum : -1, info_level, total_data));
+                fsp ? fsp->fnum : FNUM_FIELD_INVALID,
+                info_level, total_data));
 
        switch (info_level) {
 
@@ -8077,7 +8080,8 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
 
        DEBUG(3,("call_trans2setfilepathinfo(%d) %s (fnum %d) info_level=%d "
                 "totdata=%d\n", tran_call, smb_fname_str_dbg(smb_fname),
-                fsp ? fsp->fnum : -1, info_level,total_data));
+                fsp ? fsp->fnum : FNUM_FIELD_INVALID,
+                info_level,total_data));
 
        /* Realloc the parameter size */
        *pparams = (char *)SMB_REALLOC(*pparams,2);