Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7ba1cac

Browse files
committed
fix
1 parent6785c8e commit7ba1cac

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

‎src/backend/storage/file/cfs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,18 +260,20 @@ static void cfs_rc4_init(void)
260260
}
261261
}
262262

263-
voidcfs_encrypt(void*block,uint32offs,uint32size)
263+
voidcfs_encrypt(constchar*fname,void*block,uint32offs,uint32size)
264264
{
265265
if (cfs_encryption)
266266
{
267+
elog(LOG,"cfs_encrypt, fname = %s, offs = %d, size = %d",fname,offs,size);
267268
cfs_rc4_encrypt_block(block,offs,size);
268269
}
269270
}
270271

271-
voidcfs_decrypt(void*block,uint32offs,uint32size)
272+
voidcfs_decrypt(constchar*fname,void*block,uint32offs,uint32size)
272273
{
273274
if (cfs_encryption)
274275
{
276+
elog(LOG,"cfs_decrypt, fname = %s, offs = %d, size = %d",fname,offs,size);
275277
cfs_rc4_encrypt_block(block,offs,size);
276278
}
277279
}
@@ -693,7 +695,7 @@ static bool cfs_gc_file(char* map_path)
693695
Assert(res== (off_t)CFS_INODE_OFFS(inode));
694696
rc=cfs_read_file(fd,block,size);
695697
Assert(rc);
696-
cfs_decrypt(block, (off_t)i*BLCKSZ,size);
698+
cfs_decrypt(file_bck_path,block, (off_t)i*BLCKSZ,size);
697699
res=cfs_decompress(decomressedBlock,BLCKSZ,block,size);
698700
if (res!=BLCKSZ) {
699701
pg_atomic_fetch_sub_u32(&map->lock,CFS_GC_LOCK);/* release lock */

‎src/backend/storage/file/fd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ FileRead(File file, char *buffer, int amount)
17421742
}
17431743
}while (size!=0);
17441744

1745-
cfs_decrypt(compressedBuffer,VfdCache[file].seekPos,amount);
1745+
cfs_decrypt(VfdCache[file].fileName,compressedBuffer,VfdCache[file].seekPos,amount);
17461746

17471747
returnCode=cfs_decompress(buffer,BLCKSZ,compressedBuffer,amount);
17481748
if (returnCode!=BLCKSZ)
@@ -1769,7 +1769,7 @@ FileRead(File file, char *buffer, int amount)
17691769
{
17701770
if (VfdCache[file].fileFlags&PG_COMPRESSION)
17711771
{
1772-
cfs_decrypt(buffer,VfdCache[file].seekPos,amount);
1772+
cfs_decrypt(VfdCache[file].fileName,buffer,VfdCache[file].seekPos,amount);
17731773
}
17741774
VfdCache[file].seekPos+=returnCode;
17751775
}
@@ -1877,12 +1877,12 @@ FileWrite(File file, char *buffer, int amount)
18771877
inode=CFS_INODE(compressedSize,pos);
18781878
buffer=compressedBuffer;
18791879
amount=compressedSize;
1880-
cfs_encrypt(buffer,VfdCache[file].seekPos,amount);
1880+
cfs_encrypt(VfdCache[file].fileName,buffer,VfdCache[file].seekPos,amount);
18811881
}else {
18821882
if (cfs_encryption) {
18831883
memcpy(compressedBuffer,buffer,BLCKSZ);
18841884
buffer=compressedBuffer;
1885-
cfs_encrypt(buffer,VfdCache[file].seekPos,amount);
1885+
cfs_encrypt(VfdCache[file].fileName,buffer,VfdCache[file].seekPos,amount);
18861886
}
18871887
if (CFS_INODE_SIZE(inode)!=BLCKSZ) {
18881888
pos=cfs_alloc_page(map,CFS_INODE_SIZE(inode),BLCKSZ);

‎src/include/storage/cfs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ FileMap* cfs_mmap(int md);
8787
intcfs_munmap(FileMap*map);
8888
voidcfs_initialize(void);
8989

90-
voidcfs_encrypt(void*block,uint32offs,uint32size);
91-
voidcfs_decrypt(void*block,uint32offs,uint32size);
90+
voidcfs_encrypt(constchar*fname,void*block,uint32offs,uint32size);
91+
voidcfs_decrypt(constchar*fname,void*block,uint32offs,uint32size);
9292

9393
externCfsState*cfs_state;
9494

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp