view src/lib/file-set-size.h @ 22638:7d5634889da8

lib: net_ip2addr() - Optimize by allocating destination memory immediately It doesn't really matter if we allocate a few extra bytes.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sat, 04 Nov 2017 01:42:37 +0200
parents 22c81f884032
children
line wrap: on
line source

#ifndef FILE_SET_SIZE_H
#define FILE_SET_SIZE_H

/* Shrink/grow file. If file is grown, the new data is guaranteed to
   be zeros. The file offset may be anywhere after this call.
   Returns -1 if failed, 0 if successful. */
int file_set_size(int fd, off_t size);
/* Preallocate file to given size, without actually changing the size
   reported by stat(). Returns 1 if ok, 0 if not supported by this filesystem,
   -1 if error. */
int file_preallocate(int fd, off_t size);

#endif