Ver código fonte

libdpkg: Rename lock functions to have file_ as prefix

Rename lock_file to file_lock, and unlock_file to file_unlock.
Guillem Jover 16 anos atrás
pai
commit
2cede33e07
4 arquivos alterados com 10 adições e 10 exclusões
  1. 2 2
      lib/dpkg/dbmodify.c
  2. 2 2
      lib/dpkg/dpkg.h
  3. 5 5
      lib/dpkg/lock.c
  4. 1 1
      lib/dpkg/trigdeferred.l

+ 2 - 2
lib/dpkg/dbmodify.c

@@ -160,7 +160,7 @@ modstatdb_lock(const char *admindir)
     }
     }
   }
   }
 
 
-  lock_file(&dblockfd, dblockfile,
+  file_lock(&dblockfd, dblockfile,
             _("unable to lock dpkg status database"),
             _("unable to lock dpkg status database"),
             _("status database area is locked by another process"));
             _("status database area is locked by another process"));
 
 
@@ -170,7 +170,7 @@ modstatdb_lock(const char *admindir)
 void
 void
 modstatdb_unlock(void)
 modstatdb_unlock(void)
 {
 {
-  unlock_file();
+  file_unlock();
 }
 }
 
 
 enum modstatdb_rw modstatdb_init(const char *adir, enum modstatdb_rw readwritereq) {
 enum modstatdb_rw modstatdb_init(const char *adir, enum modstatdb_rw readwritereq) {

+ 2 - 2
lib/dpkg/dpkg.h

@@ -175,9 +175,9 @@ void cu_closefd(int argc, void **argv);
 
 
 /*** lock.c ***/
 /*** lock.c ***/
 
 
-void lock_file(int *lockfd, const char *filename,
+void file_lock(int *lockfd, const char *filename,
                const char *emsg, const char *emsg_eagain);
                const char *emsg, const char *emsg_eagain);
-void unlock_file(void);
+void file_unlock(void);
 
 
 /*** from mlib.c ***/
 /*** from mlib.c ***/
 
 

+ 5 - 5
lib/dpkg/lock.c

@@ -35,7 +35,7 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/dpkg-db.h>
 
 
 static void
 static void
-cu_unlock_file(int argc, void **argv)
+file_unlock_cleanup(int argc, void **argv)
 {
 {
   int lockfd = *(int*)argv[0];
   int lockfd = *(int*)argv[0];
   struct flock fl;
   struct flock fl;
@@ -50,15 +50,15 @@ cu_unlock_file(int argc, void **argv)
 }
 }
 
 
 void
 void
-unlock_file(void)
+file_unlock(void)
 {
 {
-  pop_cleanup(ehflag_normaltidy); /* Calls cu_unlock_file. */
+  pop_cleanup(ehflag_normaltidy); /* Calls file_unlock_cleanup. */
 }
 }
 
 
 /* lockfd must be allocated statically as its addresses is passed to
 /* lockfd must be allocated statically as its addresses is passed to
  * a cleanup handler. */
  * a cleanup handler. */
 void
 void
-lock_file(int *lockfd, const char *filename,
+file_lock(int *lockfd, const char *filename,
           const char *emsg, const char *emsg_eagain)
           const char *emsg, const char *emsg_eagain)
 {
 {
   struct flock fl;
   struct flock fl;
@@ -76,6 +76,6 @@ lock_file(int *lockfd, const char *filename,
     ohshite(emsg);
     ohshite(emsg);
   }
   }
 
 
-  push_cleanup(cu_unlock_file, ~0, NULL, 0, 1, lockfd);
+  push_cleanup(file_unlock_cleanup, ~0, NULL, 0, 1, lockfd);
 }
 }
 
 

+ 1 - 1
lib/dpkg/trigdeferred.l

@@ -119,7 +119,7 @@ trigdef_update_start(enum trigdef_updateflags uf, const char *admindir)
 			}
 			}
 		}
 		}
 
 
-		lock_file(&lock_fd, fn.buf, _("unable to lock triggers area"),
+		file_lock(&lock_fd, fn.buf, _("unable to lock triggers area"),
 		          NULL);
 		          NULL);
 	} else {
 	} else {
 		/* Dummy for pop_cleanups. */
 		/* Dummy for pop_cleanups. */