Skip to content

Commit a5436b5

Browse files
larsxschneidergitster
authored andcommitted
sha1_file: rename git_open_noatime() to git_open()
This function is meant to be used when reading from files in the object store, and the original objective was to avoid smudging atime of loose object files too often, hence its name. Because we'll be extending its role in the next commit to also arrange the file descriptors they return auto-closed in the child processes, rename it to lose "noatime" part that is too specific. Signed-off-by: Lars Schneider <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dec0401 commit a5436b5

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static off_t write_reused_pack(struct sha1file *f)
720720
if (!is_pack_valid(reuse_packfile))
721721
die("packfile is invalid: %s", reuse_packfile->pack_name);
722722

723-
fd = git_open_noatime(reuse_packfile->pack_name);
723+
fd = git_open(reuse_packfile->pack_name);
724724
if (fd < 0)
725725
die_errno("unable to open packfile for reuse: %s",
726726
reuse_packfile->pack_name);

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ extern int write_sha1_file(const void *buf, unsigned long len, const char *type,
11221122
extern int hash_sha1_file_literally(const void *buf, unsigned long len, const char *type, unsigned char *sha1, unsigned flags);
11231123
extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);
11241124
extern int force_object_loose(const unsigned char *sha1, time_t mtime);
1125-
extern int git_open_noatime(const char *name);
1125+
extern int git_open(const char *name);
11261126
extern void *map_sha1_file(const unsigned char *sha1, unsigned long *size);
11271127
extern int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz);
11281128
extern int parse_sha1_header(const char *hdr, unsigned long *sizep);

pack-bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int open_pack_bitmap_1(struct packed_git *packfile)
266266
return -1;
267267

268268
idx_name = pack_bitmap_filename(packfile);
269-
fd = git_open_noatime(idx_name);
269+
fd = git_open(idx_name);
270270
free(idx_name);
271271

272272
if (fd < 0)

sha1_file.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void read_info_alternates(const char * relative_base, int depth)
370370
int fd;
371371

372372
path = xstrfmt("%s/info/alternates", relative_base);
373-
fd = git_open_noatime(path);
373+
fd = git_open(path);
374374
free(path);
375375
if (fd < 0)
376376
return;
@@ -663,7 +663,7 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
663663
struct pack_idx_header *hdr;
664664
size_t idx_size;
665665
uint32_t version, nr, i, *index;
666-
int fd = git_open_noatime(path);
666+
int fd = git_open(path);
667667
struct stat st;
668668

669669
if (fd < 0)
@@ -1069,7 +1069,7 @@ static int open_packed_git_1(struct packed_git *p)
10691069
while (pack_max_fds <= pack_open_fds && close_one_pack())
10701070
; /* nothing */
10711071

1072-
p->pack_fd = git_open_noatime(p->pack_name);
1072+
p->pack_fd = git_open(p->pack_name);
10731073
if (p->pack_fd < 0 || fstat(p->pack_fd, &st))
10741074
return -1;
10751075
pack_open_fds++;
@@ -1559,7 +1559,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
15591559
return hashcmp(sha1, real_sha1) ? -1 : 0;
15601560
}
15611561

1562-
int git_open_noatime(const char *name)
1562+
int git_open(const char *name)
15631563
{
15641564
static int sha1_file_open_flag = O_NOATIME;
15651565

@@ -1605,15 +1605,15 @@ static int open_sha1_file(const unsigned char *sha1)
16051605
struct alternate_object_database *alt;
16061606
int most_interesting_errno;
16071607

1608-
fd = git_open_noatime(sha1_file_name(sha1));
1608+
fd = git_open(sha1_file_name(sha1));
16091609
if (fd >= 0)
16101610
return fd;
16111611
most_interesting_errno = errno;
16121612

16131613
prepare_alt_odb();
16141614
for (alt = alt_odb_list; alt; alt = alt->next) {
16151615
const char *path = alt_sha1_path(alt, sha1);
1616-
fd = git_open_noatime(path);
1616+
fd = git_open(path);
16171617
if (fd >= 0)
16181618
return fd;
16191619
if (most_interesting_errno == ENOENT)

0 commit comments

Comments
 (0)