int tag_scan(const char *author, const char *data, int len, uint64_t record) {
char *taglist[MAX_TAGS_PER_RECORD];
int tag_scan(const char *author, const char *data, int len, uint64_t record) {
char *taglist[MAX_TAGS_PER_RECORD];
- int n = write(tag_fd, &t, sizeof(struct tag));
- if (n < sizeof(struct tag)) {
+ int n = write(tag_fd, &t, sizeof(struct blergref));
+ if (n < sizeof(struct blergref)) {
-struct tag * tag_list(const char *tag, uint64_t offset, int *count, int direction) {
+struct blergref * tag_list(const char *tag, uint64_t offset, int *count, int direction) {
int tag_fd = open(filename, O_RDONLY, 0600);
if (tag_fd == -1) {
perror("Could not open tag file");
int tag_fd = open(filename, O_RDONLY, 0600);
if (tag_fd == -1) {
perror("Could not open tag file");
- n_tag_records = st.st_size / sizeof(struct tag);
- if (*count > n_tag_records)
- *count = n_tag_records;
+ n_tag_records = st.st_size / sizeof(struct blergref);
+ if (*count > n_tag_records - offset)
+ *count = n_tag_records - offset;
if (offset > n_tag_records) {
fprintf(stderr, "Cannot access tag record beyond end\n");
if (offset > n_tag_records) {
fprintf(stderr, "Cannot access tag record beyond end\n");
- taglist = (struct tag *) mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, tag_fd, 0);
+ taglist = (struct blergref *) mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, tag_fd, 0);
if (taglist == MAP_FAILED) {
perror("Could not mmap tag file");
goto tag_list_map_failed;
}
if (taglist == MAP_FAILED) {
perror("Could not mmap tag file");
goto tag_list_map_failed;
}