Author: adrian.chadd
Date: Tue Apr 28 04:23:25 2009
New Revision: 14003

Modified:
    branches/LUSCA_HEAD/libsqstore/store_file_ufs.c
    branches/LUSCA_HEAD/libsqstore/store_file_ufs.h

Log:
Migrate the store ufs functions to use the new class instance info



Modified: branches/LUSCA_HEAD/libsqstore/store_file_ufs.c
==============================================================================
--- branches/LUSCA_HEAD/libsqstore/store_file_ufs.c     (original)
+++ branches/LUSCA_HEAD/libsqstore/store_file_ufs.c     Tue Apr 28 04:23:25 2009
@@ -36,11 +36,13 @@
   * "buf" must be SQUID_MAXPATHLEN.
   */
  int
-store_ufs_createPath(const char *prefix, int filn, int L1, int L2, char  
*buf)
+store_ufs_createPath(store_ufs_dir_t *sd, int filn, char *buf)
  {
+    int L1 = store_ufs_l1(sd);
+    int L2 = store_ufs_l2(sd);
      buf[0] = '\0';
      snprintf(buf, SQUID_MAXPATHLEN, "%s/%02X/%02X/%08X",
-        prefix,
+        store_ufs_path(sd),
          ((filn / L2) / L2) % L1,
          (filn / L2) % L2,
          filn);
@@ -51,10 +53,10 @@
   * Create a UFS directory path given the component bits.
   */
  int
-store_ufs_createDir(const char *prefix, int L1, int L2, char *buf)
+store_ufs_createDir(store_ufs_dir_t *sd, char *buf)
  {
      buf[0] = '\0';
-    snprintf(buf, SQUID_MAXPATHLEN, "%s/%02X/%02X", prefix, L1, L2);
+    snprintf(buf, SQUID_MAXPATHLEN, "%s/%02X/%02X", store_ufs_path(sd),  
store_ufs_l1(sd), store_ufs_l2(sd));
      return 1;
  }

@@ -66,8 +68,9 @@
   * returns whether "fn" belongs in the directory F1/F2 given the  
configured L1/L2
   */
  int
-store_ufs_filenum_correct_dir(int fn, int F1, int F2, int L1, int L2)
+store_ufs_filenum_correct_dir(store_ufs_dir_t *sd, int fn, int F1, int F2)
  {
+    int L1 = store_ufs_l1(sd), L2 = store_ufs_l2(sd);
      int D1, D2;
      int filn = fn;


Modified: branches/LUSCA_HEAD/libsqstore/store_file_ufs.h
==============================================================================
--- branches/LUSCA_HEAD/libsqstore/store_file_ufs.h     (original)
+++ branches/LUSCA_HEAD/libsqstore/store_file_ufs.h     Tue Apr 28 04:23:25 2009
@@ -11,9 +11,12 @@
  extern void store_ufs_init(store_ufs_dir_t *sd, const char *path, int l1,  
int l2);
  extern void store_ufs_done(store_ufs_dir_t *sd);

-extern int store_ufs_createPath(const char *prefix, int swap_filen, int  
L1, int L2, char *buf);
-extern int store_ufs_createDir(const char *prefix, int L1, int L2, char  
*buf);
-extern int store_ufs_filenum_correct_dir(int fn, int F1, int F2, int L1,  
int L2);
+extern int store_ufs_createPath(store_ufs_dir_t *sd, int swap_filen, char  
*buf);
+extern int store_ufs_createDir(store_ufs_dir_t *sd, char *buf);
+extern int store_ufs_filenum_correct_dir(store_ufs_dir_t *sd, int fn, int  
F1, int F2);

+static inline int store_ufs_l1(store_ufs_dir_t *sd) { return sd->l1; }
+static inline int store_ufs_l2(store_ufs_dir_t *sd) { return sd->l2; }
+static inline const char * store_ufs_path(store_ufs_dir_t *sd) { return  
sd->path; }

  #endif

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to