Changes needed to the file_info structure

Richard Sharpe sharpe at ns.aus.com
Sat May 2 03:55:53 GMT 1998


Hi folks,

I am contemplating changes to the file_info structure or creating a
parallel structure.

I need two things in clitar:

1.  I need dynamic length file names, so the pstring structure no longer 
    suits. This is needed to properly handle some of the long directory 
    names we might encounter in clitar.

2.  I need to link directory names together so that I can set the mtime 
    correctly. I need a simple doubly linked list here so I can insert things
    at the tail and go back up the list and go down the list as well.
    This is needed so we can set the mtime correctly on a directly.  You 
    have to set it after you have finished with the directory.

The current file_info structure is:

  typedef struct
  {
     int size;
     int mode;
     int uid;
     int gid;
     /* these times are normally kept in GMT */
     time_t mtime;
     time_t atime;
     time_t ctime;
     pstring name;

  } file_info;

I need to change the name entry to char *name and then to dynamically
allocate that. I also want to add:

   file_info *next, *prev;

so I can link these things together.

As I am going to be recording the path from the root of the tree to the
current directory in this structure, and adjusting the list as I change
directory (either adding a new node on the end as the tree deepens, or
backtracking [and changing mtime on the SMB server as I leave a subtree],
unlinking and relinking) I will need a few simple operations.

I was thinking of adding them to a separate cli_utils.c or something like
that and adding a file_info2 structure for the moment.

Does anyone have any other suggestions.



Regards
-------
Richard Sharpe, sharpe at ns.aus.com, NIC-Handle:RJS96
NS Computer Software and Services P/L, 
Ph: +61-8-8281-0063, FAX: +61-8-8250-2080, 
Linux, AIX, Digital UNIX, ULTRIX, SunOS, Samba, Apache, NetScape,
StrongHold, Perl, C, PPP ...


More information about the samba-technical mailing list